You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by gg...@apache.org on 2020/06/27 12:57:26 UTC

[commons-text] branch master updated: Reuse Objects.toString().

This is an automated email from the ASF dual-hosted git repository.

ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-text.git


The following commit(s) were added to refs/heads/master by this push:
     new c60d835  Reuse Objects.toString().
c60d835 is described below

commit c60d835cb10098a153ea76553946e2ff3f7362c8
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Sat Jun 27 08:57:19 2020 -0400

    Reuse Objects.toString().
---
 src/main/java/org/apache/commons/text/lookup/MapStringLookup.java | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/main/java/org/apache/commons/text/lookup/MapStringLookup.java b/src/main/java/org/apache/commons/text/lookup/MapStringLookup.java
index c70a611..d7d9a94 100644
--- a/src/main/java/org/apache/commons/text/lookup/MapStringLookup.java
+++ b/src/main/java/org/apache/commons/text/lookup/MapStringLookup.java
@@ -17,6 +17,7 @@
 package org.apache.commons.text.lookup;
 
 import java.util.Map;
+import java.util.Objects;
 
 /**
  * A map-based lookup where the request for a lookup is answered with the value for that key.
@@ -87,7 +88,7 @@ final class MapStringLookup<V> implements StringLookup {
             // Could be a ConcurrentHashMap and a null key request
             return null;
         }
-        return obj != null ? obj.toString() : null;
+        return Objects.toString(obj, null);
     }
 
     @Override