Skip to content

Commit 7749ede

Browse files
committed
Use better Map API (Java 8)
Javadoc
1 parent a9b7c1e commit 7749ede

1 file changed

Lines changed: 2 additions & 3 deletions

File tree

src/main/java/org/apache/commons/cli/TypeHandler.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -190,15 +190,14 @@ public static Object createValue(final String str, final Object obj) throws Pars
190190
}
191191

192192
/**
193-
* Gets the converter for the the Class. Never null.
193+
* Gets the registered converter for the the Class, or {@link Converter#DEFAULT} if absent.
194194
*
195195
* @param clazz The Class to get the Converter for.
196196
* @return the registered converter if any, {@link Converter#DEFAULT} otherwise.
197197
* @since 1.7.0
198198
*/
199199
public static Converter<?, ?> getConverter(final Class<?> clazz) {
200-
final Converter<?, ?> converter = converterMap.get(clazz);
201-
return converter == null ? Converter.DEFAULT : converter;
200+
return converterMap.getOrDefault(clazz, Converter.DEFAULT);
202201
}
203202

204203
/**

0 commit comments

Comments
 (0)