List of usage examples for com.google.common.collect Iterables concat
public static <T> Iterable<T> concat(final Iterable<? extends Iterable<? extends T>> inputs)
From source file:org.eclipse.xtext.resource.impl.AbstractCompoundSelectable.java
@Override public Iterable<IEObjectDescription> getExportedObjects() { return Iterables.concat( Iterables.transform(getSelectables(), new Function<ISelectable, Iterable<IEObjectDescription>>() { @Override//from ww w. ja v a 2 s. c o m public Iterable<IEObjectDescription> apply(ISelectable from) { if (from != null) return from.getExportedObjects(); return Collections.emptyList(); } })); }
From source file:org.caleydo.view.domino.api.model.typed.util.ConcatedList.java
@Override public Iterator<T> iterator() { return Iterables.concat(groups).iterator(); }
From source file:org.apache.aurora.scheduler.filter.ConstraintMatcher.java
/** * Gets the veto (if any) for a scheduling constraint based on the {@link AttributeAggregate} this * filter was created with.//from w w w . j a va 2 s .com * * @param constraint Scheduling filter to check. * @return A veto if the constraint is not satisfied based on the existing state of the job. */ static Optional<Veto> getVeto(AttributeAggregate cachedjobState, Iterable<IAttribute> hostAttributes, IConstraint constraint) { Iterable<IAttribute> sameNameAttributes = Iterables.filter(hostAttributes, new NameFilter(constraint.getName())); Optional<IAttribute> attribute; if (Iterables.isEmpty(sameNameAttributes)) { attribute = Optional.absent(); } else { Set<String> attributeValues = ImmutableSet .copyOf(Iterables.concat(Iterables.transform(sameNameAttributes, GET_VALUES))); attribute = Optional.of(IAttribute.build(new Attribute(constraint.getName(), attributeValues))); } ITaskConstraint taskConstraint = constraint.getConstraint(); switch (taskConstraint.getSetField()) { case VALUE: boolean matches = AttributeFilter.matches(attribute.transform(GET_VALUES).or(ImmutableSet.of()), taskConstraint.getValue()); return matches ? Optional.absent() : Optional.of(Veto.constraintMismatch(constraint.getName())); case LIMIT: if (!attribute.isPresent()) { return Optional.of(Veto.constraintMismatch(constraint.getName())); } boolean satisfied = AttributeFilter.matches(attribute.get(), taskConstraint.getLimit().getLimit(), cachedjobState); return satisfied ? Optional.absent() : Optional.of(Veto.unsatisfiedLimit(constraint.getName())); default: throw new SchedulerException( "Failed to recognize the constraint type: " + taskConstraint.getSetField()); } }
From source file:com.madvay.tools.android.perf.common.TraceTransformableTable.java
public void splitTraces() { setRows(Lists.newArrayList(Iterables.concat(Iterables.transform(getRows(), new Function<T, Iterable<T>>() { @Override//from w ww . j a va 2 s . c om public Iterable<T> apply(T input) { List<T> ret = new ArrayList<T>(); for (StackTraceElement ste : input.getTransformableTrace()) { ret.add(newRowWithTrace(input, Lists.newArrayList(ste))); } return ret; } })))); }
From source file:com.google.currysrc.api.input.CompoundDirectoryInputFileGenerator.java
@Override public Iterable<? extends File> generate() { List<Iterable<? extends File>> iterables = new ArrayList<>(generators.size()); for (InputFileGenerator generator : generators) { iterables.add(generator.generate()); }//w w w. j ava2s . co m return Iterables.concat(iterables); }
From source file:org.calrissian.mango.collect.CloseableIterables.java
/** * Combines multiple iterables into a single closeable iterable. * The returned closeable iterable has an iterator that traverses the elements * of each iterable in {@code inputs}. The input iterators are not polled until * necessary.//from www.jav a2s . c om */ public static <T> CloseableIterable<T> concat(final CloseableIterable<? extends Iterable<? extends T>> inputs) { return wrap(Iterables.concat(inputs), inputs); }
From source file:com.spotify.folsom.client.Utils.java
public static <T> Function<List<List<T>>, List<T>> flatten() { return new Function<List<List<T>>, List<T>>() { @Override//from ww w .j a v a2 s.c o m public List<T> apply(final List<List<T>> input) { return Lists.newArrayList(Iterables.concat(input)); } }; }
From source file:com.google.devtools.build.skyframe.NodeEntrySubject.java
IterableSubject hasTemporaryDirectDepsThat() { return assertThat(Iterables.concat(getSubject().getTemporaryDirectDeps())) .named(detail("TemporaryDirectDeps")); }
From source file:org.opendaylight.yangtools.yang.data.impl.schema.transform.base.serializer.ListNodeBaseSerializer.java
@Override public final Iterable<E> serialize(final ListSchemaNode schema, final N node) { return Iterables.concat(Iterables.transform(node.getValue(), input -> { final Iterable<E> serializedChild = getListEntryNodeSerializer().serialize(schema, input); final int size = Iterables.size(serializedChild); Preconditions.checkState(size == 1, "Unexpected count of entries for list serialized from: %s, should be 1, was: %s", input, size); return serializedChild; }));// ww w.j a v a2 s. com }
From source file:de.kussm.direction.Directions.java
public static Directions $(DirectionIterable... args) { return new Directions(Iterables.concat(args)); }