public static List<DimFilter> filterNulls(List<DimFilter> optimized) { return Lists.newArrayList(Iterables.filter(optimized, Predicates.notNull())); } }
@Override public Iterable<Vertex> getNeighbors(final int value) { return Iterables.transform(Iterables.filter(outEdges, new Predicate<Edge>() { @Override public boolean apply(@Nullable Edge edge) { return !CHECK_VALUE || ((Integer) edge.getProperty("number")).intValue() == value; } }), new Function<Edge, Vertex>() { @Override public Vertex apply(@Nullable Edge edge) { return edge.getEnd(); } }); }
@Override public <T extends LogicalSegment> List<T> filterSegments(DataSourceMetadataQuery query, List<T> segments) { if (segments.size() <= 1) { return segments; } final T max = segments.get(segments.size() - 1); return Lists.newArrayList( Iterables.filter( segments, new Predicate<T>() { @Override public boolean apply(T input) { return max != null && input.getInterval().overlaps(max.getInterval()); } } ) ); }
/** * Split each element of an Iterable<String> at commas. * @param input Iterable over strings. * @return An Iterable over string which breaks down each input element at comma boundaries */ @Nonnull public static List<String> splitAtCommasAndTrim(Iterable<String> input) { if(input==null) { return Collections.emptyList(); } Iterable<String> nonEmptyInputs = Iterables.filter(input, Predicates.notNull()); return Lists.newArrayList(Iterables.concat(Iterables.transform(nonEmptyInputs, COMMA_SPLITTER))); }
@Deprecated @JsonIgnore public List<SpatialDimensionSchema> getSpatialDimensions() { Iterable<NewSpatialDimensionSchema> filteredList = Iterables.filter(dimensions, NewSpatialDimensionSchema.class); Iterable<SpatialDimensionSchema> transformedList = Iterables.transform( filteredList, new Function<NewSpatialDimensionSchema, SpatialDimensionSchema>() { @Nullable @Override public SpatialDimensionSchema apply(NewSpatialDimensionSchema input) { return new SpatialDimensionSchema(input.getName(), input.getDims()); } } ); return Lists.newArrayList(transformedList); }
public List<RealizationEntry> getRealizationEntries(final RealizationType type) { if (type == null) return getRealizationEntries(); return ImmutableList.copyOf(Iterables.filter(realizationEntries, new Predicate<RealizationEntry>() { @Override public boolean apply(@Nullable RealizationEntry input) { return input.getType() == type; } })); }
/** * Returns a fetch of transformers applicable to the given constructor. * * @param constructor constructor * @return transformers */ public static Iterable<Function<Object[], Object[]>> getTransformers(Constructor<?> constructor) { Iterable<ArgumentTransformer> transformers = Lists.newArrayList( new PrimitiveAwareVarArgsTransformer(constructor), new PrimitiveTransformer(constructor), new VarArgsTransformer(constructor)); return ImmutableList .<Function<Object[], Object[]>>copyOf(filter(transformers, applicableFilter)); }
List<String> explicitColumnOrder = new ArrayList<>(ImmutableList.copyOf(transform(extras, ExtraColumnMetadata::getName))); hiddenColumns = ImmutableSet.copyOf(transform(filter(extras, ExtraColumnMetadata::isHidden), ExtraColumnMetadata::getName)); Iterables.addAll(explicitColumnOrder, filter(columnNames, not(in(explicitColumnOrder))));
/** * Combine multiple lists into one. * * @param list1 The first list to combine. * @param list2 The second list to combine. * @param list3 The third list to combine. * @param list4 The fourth list to combine. * @param list5 The fifth list to combine. * @param list6 The sixth list to combine. * @param list7 The seventh list to combine. * @return A new list with all input lists combined. */ public static List<?> combine(Iterable list1, Iterable list2, Iterable list3, Iterable list4, Iterable list5, Iterable list6, Iterable list7) { Iterable<Iterable<?>> nonNullLists = Iterables.filter( Lists.<Iterable<?>>newArrayList(list1, list2, list3, list4, list5, list6, list7), Predicates.notNull()); return ImmutableList.copyOf(Iterables.concat(nonNullLists)); }
@Override public Collection<DatasetVersion> listDeletableVersions(List<DatasetVersion> allVersions) { return Lists.newArrayList(Iterables.filter(allVersions, Predicates.not(this.predicate))); } }
public RelationType(List<Field> fields) { requireNonNull(fields, "fields is null"); this.allFields = ImmutableList.copyOf(fields); this.visibleFields = ImmutableList.copyOf(Iterables.filter(fields, not(Field::isHidden))); int index = 0; ImmutableMap.Builder<Field, Integer> builder = ImmutableMap.builder(); for (Field field : fields) { builder.put(field, index++); } fieldIndexes = builder.build(); }
public void setOutputValues(Iterable<?> objects) { if (objects == null) { this.outputValues = ImmutableList.of(); currentView.setOutputValues(ImmutableList.of()); } else { Iterable<?> nonNulls = Iterables.filter(objects, Predicates.notNull()); this.outputValues = ImmutableList.copyOf(nonNulls); currentView.setOutputValues(ImmutableList.copyOf(this.outputValues)); } }
final List<Class<? extends ResourceFilter>> baseResourceFilters = clazz.getAnnotation(ResourceFilters.class) == null ? Collections.emptyList() : ImmutableList.copyOf(((ResourceFilters) clazz.getAnnotation(ResourceFilters.class)).value()); return ImmutableList.copyOf( Iterables.concat( Iterables.transform( Iterables.filter(
for (Expression expression : filter(equalitySet, not(derivedExpressions::contains))) { Expression scopeRewritten = rewriteExpression(expression, symbolScope, false); if (scopeRewritten != null) { scopeExpressions.add(scopeRewritten); Expression scopeComplementRewritten = rewriteExpression(expression, not(symbolScope), false); if (scopeComplementRewritten != null) { scopeComplementExpressions.add(scopeComplementRewritten); for (Expression expression : filter(scopeExpressions, not(equalTo(matchingCanonical)))) { scopeEqualities.add(new ComparisonExpression(ComparisonExpression.Operator.EQUAL, matchingCanonical, expression)); for (Expression expression : filter(scopeComplementExpressions, not(equalTo(complementCanonical)))) { scopeComplementEqualities.add(new ComparisonExpression(ComparisonExpression.Operator.EQUAL, complementCanonical, expression)); connectingExpressions.add(complementCanonical); connectingExpressions.addAll(scopeStraddlingExpressions); connectingExpressions = ImmutableList.copyOf(filter(connectingExpressions, Predicates.notNull())); Expression connectingCanonical = getCanonical(connectingExpressions); if (connectingCanonical != null) { for (Expression expression : filter(connectingExpressions, not(equalTo(connectingCanonical)))) { scopeStraddlingEqualities.add(new ComparisonExpression(ComparisonExpression.Operator.EQUAL, connectingCanonical, expression));
/** * Implementation for the invokeAll methods, needs to be passed an accessor * function that is responsible for getting things from the CompletionService. */ <T> Iterable<T> invokeAllTasks(final Iterable<? extends Callable<T>> callables, final Accessor<T> accessor) { final CompletionService<T> apply = completionServiceDecorator.apply(completionServiceFactory.<T> create().apply(executor)); // we must copy the resulting Iterable<Supplier> so // each iteration doesn't resubmit the jobs final Iterable<Supplier<T>> lazyAsyncSuppliers = copyOf(transform(callables, new AsyncCompletionFunction<T>(apply, accessor))); final Iterable<Supplier<T>> handled = transform(lazyAsyncSuppliers, policy.<T> handler()); return filter(transform(handled, Functions.<T> fromSupplier()), notNull()); }
splitProperties.setProperty(FILE_INPUT_FORMAT, storageFormat.getInputFormat()); splitProperties.setProperty(SERIALIZATION_LIB, storageFormat.getSerDe()); splitProperties.setProperty("columns", Joiner.on(',').join(transform(filter(testColumns, not(TestColumn::isPartitionKey)), TestColumn::getName))); splitProperties.setProperty("columns.types", Joiner.on(',').join(transform(filter(testColumns, not(TestColumn::isPartitionKey)), TestColumn::getType)));
List<TypeMirror> getExplicitBounds(TypeParameterElement typeParam) { return newArrayList(Iterables.filter(typeParam.getBounds(), notObject)); }