/** * Adapts the given Enumeration as an Iterable object for use within a for each loop. * * @param <T> the class type of the Enumeration elements. * @param enumeration the Enumeration to adapt as an Iterable object. * @return an Iterable instance of the Enumeration. * @see java.lang.Iterable * @see java.util.Enumeration */ @NonNull public static <T> Iterable<T> iterable(@Nullable Enumeration<T> enumeration) { return () -> toIterator(nullSafeEnumeration(enumeration)); }
/** * Adapts the given Enumeration as an Iterable object for use within a for each loop. * * @param <T> the class type of the Enumeration elements. * @param enumeration the Enumeration to adapt as an Iterable object. * @return an Iterable instance of the Enumeration. * @see java.lang.Iterable * @see java.util.Enumeration */ @NonNull public static <T> Iterable<T> iterable(@Nullable Enumeration<T> enumeration) { return () -> toIterator(nullSafeEnumeration(enumeration)); }