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-cli.git


The following commit(s) were added to refs/heads/master by this push:
     new 7749ede  Use better Map API (Java 8)
7749ede is described below

commit 7749ededd334c50063e400a032c73e6b012a68c6
Author: Gary Gregory <[email protected]>
AuthorDate: Sun Apr 7 10:01:59 2024 -0400

    Use better Map API (Java 8)
    
    Javadoc
---
 src/main/java/org/apache/commons/cli/TypeHandler.java | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/src/main/java/org/apache/commons/cli/TypeHandler.java 
b/src/main/java/org/apache/commons/cli/TypeHandler.java
index f7cf4fe..8fada22 100644
--- a/src/main/java/org/apache/commons/cli/TypeHandler.java
+++ b/src/main/java/org/apache/commons/cli/TypeHandler.java
@@ -190,15 +190,14 @@ public class TypeHandler {
     }
 
     /**
-     * Gets the converter for the the Class. Never null.
+     * Gets the registered converter for the the Class, or {@link 
Converter#DEFAULT} if absent.
      *
      * @param clazz The Class to get the Converter for.
      * @return the registered converter if any, {@link Converter#DEFAULT} 
otherwise.
      * @since 1.7.0
      */
     public static Converter<?, ?> getConverter(final Class<?> clazz) {
-        final Converter<?, ?> converter = converterMap.get(clazz);
-        return converter == null ? Converter.DEFAULT : converter;
+        return converterMap.getOrDefault(clazz, Converter.DEFAULT);
     }
 
     /**

Reply via email to