Skip to content

Commit bdbc6cb

Browse files
committed
Use ternary.
1 parent 0aba82a commit bdbc6cb

File tree

1 file changed

+2
-7
lines changed

1 file changed

+2
-7
lines changed

src/main/java/org/apache/commons/lang3/ClassUtils.java

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1465,16 +1465,11 @@ public static Class<?>[] primitivesToWrappers(final Class<?>... classes) {
14651465
* </p>
14661466
*
14671467
* @param cls the class to convert, may be null.
1468-
* @return the wrapper class for {@code cls} or {@code cls} if {@code cls} is not a primitive. {@code null} if null
1469-
* input.
1468+
* @return the wrapper class for {@code cls} or {@code cls} if {@code cls} is not a primitive. {@code null} if null input.
14701469
* @since 2.1
14711470
*/
14721471
public static Class<?> primitiveToWrapper(final Class<?> cls) {
1473-
Class<?> convertedClass = cls;
1474-
if (cls != null && cls.isPrimitive()) {
1475-
convertedClass = PRIMITIVE_WRAPPER_MAP.get(cls);
1476-
}
1477-
return convertedClass;
1472+
return cls != null && cls.isPrimitive() ? PRIMITIVE_WRAPPER_MAP.get(cls) : cls;
14781473
}
14791474

14801475
/**

0 commit comments

Comments
 (0)