List of usage examples for com.google.common.collect Iterators concat
public static <T> Iterator<T> concat(Iterator<? extends T> a, Iterator<? extends T> b)
From source file:org.fcrepo.kernel.modeshape.rdf.impl.ReferencesRdfContext.java
@SuppressWarnings("unchecked") private void putReferencesIntoContext(final Node node) throws RepositoryException { Iterator<Property> references = node.getReferences(); Iterator<Property> weakReferences = node.getWeakReferences(); Iterator<Property> allReferences = Iterators.concat(references, weakReferences); concat(flatMap(allReferences, property2triple)); references = node.getReferences();/*from w w w . ja v a 2s.c om*/ weakReferences = node.getWeakReferences(); allReferences = Iterators.concat(references, weakReferences); concat(Iterators.filter(flatMap(flatMap(allReferences, potentialProxies), triplesForValue), INBOUND::test)); }
From source file:fr.inria.eventcloud.delayers.buffers.QuadrupleBuffer.java
/** * {@inheritDoc}/*from w w w. j a va 2s .co m*/ */ @Override public Iterator<Quadruple> iterator() { return Iterators.concat(this.metaQuadruples.iterator(), this.nonMetaQuadruples.iterator()); }
From source file:com.stottlerhenke.versionspaces.VSUnionIterator.java
/** * Constructor.//from w ww.j a va2s . co m * * @param vss The version spaces to union. */ public VSUnionIterator(final Iterable<VS<In, Out>> vss) { Iterator<ConfidentHypothesis<In, Out>> tmpItr = Iterators.emptyIterator(); int totalConfidence = 0; for (VS<In, Out> vs : vss) { if (vs.iterator().hasNext()) { totalConfidence++; } tmpItr = Iterators.concat(tmpItr, vs.iterator()); } // transform the compound iterator so that the confidences sum to 1.0 _itr = Iterators.transform(tmpItr, new UnionFn(totalConfidence)); }
From source file:org.sonar.php.tree.impl.statement.ElseifClauseTreeImpl.java
@Override public Iterator<Tree> childrenIterator() { return Iterators.concat(Iterators.forArray(elseifToken, condition, colonToken), statements.iterator()); }
From source file:sg.atom.utils._beta.functional.FunctionalIterator.java
public FunctionalIterator<T> concat(Iterator<T>... toConcat) { if (toConcat.length == 1) { return new FunctionalIterator<T>(Iterators.concat(delegate, toConcat[0])); }/*from w w w .ja v a 2 s .c om*/ return new FunctionalIterator<T>(Iterators.concat(delegate, Iterators.concat(toConcat))); }
From source file:org.matsim.contrib.dvrp.router.DivertedVrpPath.java
@Override public Iterator<Link> iterator() { return Iterators.concat(Iterators.limit(originalPath.iterator(), diversionLinkIdx), newSubPath.iterator()); }
From source file:nz.ac.massey.cs.guery.impl.BreadthFirstPathFinder.java
private Iterator<Path<V, E>> findDirectLinks(final GraphAdapter<V, E> g, V start, int minLength, boolean outgoing, Predicate<E> filter, boolean computeAll) { Iterator<Path<V, E>> nullIter = null; if (minLength == 0) { Path<V, E> path = new LREmptyPath(start); nullIter = (Iterator<Path<V, E>>) Iterators.singletonIterator(path); }//from w ww. j a v a2 s. com Iterator<E> edges = outgoing ? g.getOutEdges(start, filter) : g.getInEdges(start, filter); Iterator<Path<V, E>> paths = Iterators.transform(edges, new Function<E, Path<V, E>>() { @Override public Path<V, E> apply(E e) { return new SingletonPath<V, E>(e, g); } }); return nullIter == null ? paths : Iterators.concat(nullIter, paths); }
From source file:org.eclipse.sirius.business.api.query.DViewQuery.java
/** * Get all the EObject following a predicate from all the * {@link DRepresentation} inside the {@link DView} ({@link DRepresentation} * s are not owned by the {@link DView}). * /* w ww .j a v a 2 s . c o m*/ * @param predicate * predicate used to filter the result * @return the result iterator */ public Iterator<EObject> getAllContentInRepresentations(final Predicate<? super EObject> predicate) { Iterator<EObject> iterator = Collections.emptyIterator(); List<DRepresentation> allRepresentations = this.getLoadedRepresentations(); for (DRepresentation dRepresentation : allRepresentations) { UnmodifiableIterator<EObject> currentIterator = Iterators.filter(dRepresentation.eAllContents(), predicate); iterator = Iterators.concat(iterator, currentIterator); } return iterator; }
From source file:lanchon.dexpatcher.core.model.BasicClassDef.java
@Override public Iterable<? extends Field> getFields() { return new Iterable<Field>() { @Override/* www .j a v a 2 s .c o m*/ public Iterator<Field> iterator() { return Iterators.concat(staticFields.iterator(), instanceFields.iterator()); } }; }
From source file:org.eclipse.xtext.xbase.lib.IteratorExtensions.java
/** * <p>//from ww w .j a v a 2 s .c o m * Concatenates two iterators into a single iterator. The returned iterator traverses the * elements in {@code a}, followed by the elements in {@code b}. The resulting iterator is effectivly a view on the * source iterators. That is, the source iterators are not polled until necessary and the result will reflect * changes in the sources. * </p> * <p> * The returned iterator supports {@code remove()} when the corresponding input iterator supports it. * </p> * * @param a * the first iterator. May not be <code>null</code>. * @param b * the second iterator. May not be <code>null</code>. * @return a combined iterator. Never <code>null</code>. */ @Pure @Inline(value = "$3.$4concat($1, $2)", imported = Iterators.class) public static <T> Iterator<T> operator_plus(Iterator<? extends T> a, Iterator<? extends T> b) { return Iterators.concat(a, b); }