Use Stream.

This commit is contained in:
Gary Gregory 2022-08-21 11:04:28 -04:00
parent 0d5d1fc119
commit f9484a4b96
1 changed files with 5 additions and 6 deletions

View File

@ -69,12 +69,11 @@ public class AnnotationUtils {
*/
@Override
protected String getShortClassName(final Class<?> cls) {
for (final Class<?> iface : ClassUtils.getAllInterfaces(cls)) {
if (Annotation.class.isAssignableFrom(iface)) {
return "@" + iface.getName();
}
}
return StringUtils.EMPTY;
// formatter:off
return ClassUtils.getAllInterfaces(cls).stream().filter(Annotation.class::isAssignableFrom).findFirst()
.map(iface -> "@" + iface.getName())
.orElse(StringUtils.EMPTY);
// formatter:on
}
/**