private static <T extends LogicalOperator> Iterable<T> findOperator(LogicalPlan plan, final Class<T> operatorClazz) { return (Iterable<T>) Iterables.filter(plan.getSortedOperators(), new Predicate<LogicalOperator>() { @Override public boolean apply(LogicalOperator input) { return input.getClass().equals(operatorClazz); } }); }
/** * Returns the elements from this fluent iterable that satisfy a predicate. The resulting fluent * iterable's iterator does not support {@code remove()}. * * <p><b>{@code Stream} equivalent:</b> {@link Stream#filter} (same). */ public final FluentIterable<E> filter(Predicate<? super E> predicate) { return from(Iterables.filter(getDelegate(), predicate)); }
private static Iterable<Type> filterUpperBounds(Iterable<Type> bounds) { return Iterables.filter(bounds, Predicates.not(Predicates.<Type>equalTo(Object.class))); }
/** * Returns the elements from this fluent iterable that are instances of class {@code type}. * * <p><b>{@code Stream} equivalent:</b> {@code stream.filter(type::isInstance).map(type::cast)}. * This does perform a little more work than necessary, so another option is to insert an * unchecked cast at some later point: * * <pre> * {@code @SuppressWarnings("unchecked") // safe because of ::isInstance check * ImmutableList<NewType> result = * (ImmutableList) stream.filter(NewType.class::isInstance).collect(toImmutableList());} * </pre> */ @GwtIncompatible // Class.isInstance public final <T> FluentIterable<T> filter(Class<T> type) { return from(Iterables.filter(getDelegate(), type)); }
/** * Returns a view of {@code unfiltered} containing all elements that are of the type {@code * desiredType}. The returned iterable's iterator does not support {@code remove()}. * * <p><b>{@code Stream} equivalent:</b> {@code stream.filter(type::isInstance).map(type::cast)}. * This does perform a little more work than necessary, so another option is to insert an * unchecked cast at some later point: * * <pre> * {@code @SuppressWarnings("unchecked") // safe because of ::isInstance check * ImmutableList<NewType> result = * (ImmutableList) stream.filter(NewType.class::isInstance).collect(toImmutableList());} * </pre> */ @SuppressWarnings("unchecked") @GwtIncompatible // Class.isInstance public static <T> Iterable<T> filter(final Iterable<?> unfiltered, final Class<T> desiredType) { checkNotNull(unfiltered); checkNotNull(desiredType); return (Iterable<T>) filter(unfiltered, Predicates.instanceOf(desiredType)); }
newRowFields.addAll(convertedInput.getRowType().getFieldList()); Iterable<RelDataTypeField> newWindowFields = Iterables.filter(window.getRowType().getFieldList(), new Predicate<RelDataTypeField>() { @Override public boolean apply(RelDataTypeField relDataTypeField) {