/** * Returns all instances of class {@code type} in {@code unfiltered}. The * returned iterator has elements whose class is {@code type} or a subclass of * {@code type}. * * @param unfiltered an iterator containing objects of any type * @param type the type of elements desired * @return an unmodifiable iterator containing all elements of the original * iterator that were of the requested type */ @SuppressWarnings("unchecked") // can cast to <T> because non-Ts are removed @GwtIncompatible("Class.isInstance") public static <T> UnmodifiableIterator<T> filter( Iterator<?> unfiltered, Class<T> type) { return (UnmodifiableIterator<T>) filter(unfiltered, instanceOf(type)); }
/** * Returns all instances of class {@code type} in {@code unfiltered}. The * returned iterator has elements whose class is {@code type} or a subclass of * {@code type}. * * @param unfiltered an iterator containing objects of any type * @param type the type of elements desired * @return an unmodifiable iterator containing all elements of the original * iterator that were of the requested type */ @SuppressWarnings("unchecked") // can cast to <T> because non-Ts are removed @GwtIncompatible("Class.isInstance") public static <T> UnmodifiableIterator<T> filter( Iterator<?> unfiltered, Class<T> type) { return (UnmodifiableIterator<T>) filter(unfiltered, instanceOf(type)); }
/** * Returns all instances of class {@code type} in {@code unfiltered}. The * returned iterator has elements whose class is {@code type} or a subclass of * {@code type}. * * @param unfiltered an iterator containing objects of any type * @param type the type of elements desired * @return an unmodifiable iterator containing all elements of the original * iterator that were of the requested type */ @SuppressWarnings("unchecked") // can cast to <T> because non-Ts are removed @GwtIncompatible("Class.isInstance") public static <T> UnmodifiableIterator<T> filter( Iterator<?> unfiltered, Class<T> type) { return (UnmodifiableIterator<T>) filter(unfiltered, instanceOf(type)); }
/** * Returns all instances of class {@code type} in {@code unfiltered}. The * returned iterator has elements whose class is {@code type} or a subclass of * {@code type}. * * @param unfiltered an iterator containing objects of any type * @param type the type of elements desired * @return an unmodifiable iterator containing all elements of the original * iterator that were of the requested type */ @SuppressWarnings("unchecked") // can cast to <T> because non-Ts are removed @GwtIncompatible("Class.isInstance") public static <T> UnmodifiableIterator<T> filter( Iterator<?> unfiltered, Class<T> type) { return (UnmodifiableIterator<T>) filter(unfiltered, instanceOf(type)); }