public static List<Class<?>> getAllInterfaces(final Class<?> cls) { return Stream.concat( Arrays.stream(cls.getInterfaces()).flatMap(intf -> Stream.concat(Stream.of(intf), getAllInterfaces(intf).stream())), cls.getSuperclass() == null ? Stream.empty() : getAllInterfaces(cls.getSuperclass()).stream() ).distinct().collect(Collectors.toList()); }
public static List<Class<?>> getAllInterfaces(final Class<?> cls) { return Stream.concat( Arrays.stream(cls.getInterfaces()).flatMap(intf -> Stream.concat(Stream.of(intf), getAllInterfaces(intf).stream())), cls.getSuperclass() == null ? Stream.empty() : getAllInterfaces(cls.getSuperclass()).stream() ).distinct().collect(Collectors.toList()); }