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.grouplens.grapht.util.AbstractChain.java
@Nonnull @Override/*from w w w . ja va 2s. c o m*/ public Iterator<E> iterator() { Iterator<E> current = Iterators.singletonIterator(tailValue); if (previous == null) { return current; } else { return Iterators.concat(previous.iterator(), current); } }
From source file:com.wrmsr.wava.core.type.Signature.java
@Override public Iterator<Type> iterator() { return Iterators.concat(Iterators.singletonIterator(result), arguments.iterator()); }
From source file:io.crate.operation.merge.PassThroughPagingIterator.java
@Override public void merge(Iterable<? extends KeyIterable<TKey, TRow>> iterables) { Iterable<TRow> concat = Iterables.concat(iterables); if (repeatable) { this.iterables.addAll(iterables); this.storedForRepeat = null; }/* w w w. j a v a 2 s . c o m*/ if (iterator.hasNext()) { iterator = Iterators.concat(iterator, concat.iterator()); } else { iterator = concat.iterator(); } }
From source file:org.sonar.pickbasic.tree.impl.statement.BeginCaseCaseClauseTreeImpl.java
@Override public Iterator<Tree> childrenIterator() { return Iterators.concat(Iterators.forArray(caseKeyword, expression), statements.iterator()); }
From source file:org.caleydo.view.domino.api.model.typed.util.BitSetSet.java
@Override public Iterator<Integer> iterator() { if (positives.isEmpty() && negatives.isEmpty()) return Iterators.emptyIterator(); if (positives.isEmpty()) return new BitSetIterator(negatives, false); if (negatives.isEmpty()) return new BitSetIterator(positives, true); return Iterators.concat(new BitSetIterator(negatives, false), new BitSetIterator(positives, true)); }
From source file:org.geogit.cli.porcelain.FormatPatch.java
/** * Executes the format-patch command with the specified options. *//*from ww w. j ava2 s . c om*/ @Override protected void runInternal(GeogitCLI cli) throws IOException { checkParameter(refSpec.size() > 2, "Commit list is too long :%s", refSpec); GeoGIT geogit = cli.getGeogit(); checkParameter(file != null, "Patch file not specified"); DiffOp diff = geogit.command(DiffOp.class).setReportTrees(true); String oldVersion = resolveOldVersion(); String newVersion = resolveNewVersion(); diff.setOldVersion(oldVersion).setNewVersion(newVersion).setCompareIndex(cached); Iterator<DiffEntry> entries; if (paths.isEmpty()) { entries = diff.setProgressListener(cli.getProgressListener()).call(); } else { entries = Iterators.emptyIterator(); for (String path : paths) { Iterator<DiffEntry> moreEntries = diff.setFilter(path) .setProgressListener(cli.getProgressListener()).call(); entries = Iterators.concat(entries, moreEntries); } } if (!entries.hasNext()) { cli.getConsole().println("No differences found"); return; } Patch patch = geogit.command(CreatePatchOp.class).setDiffs(entries).call(); FileOutputStream fos = new FileOutputStream(file); OutputStreamWriter out = new OutputStreamWriter(fos, "UTF-8"); PatchSerializer.write(out, patch); }
From source file:org.bimserver.database.queries.QueryIncludeStackFrame.java
public QueryIncludeStackFrame(QueryObjectProvider queryObjectProvider, QueryContext queryContext, CanInclude previousInclude, Include include, HashMapVirtualObject currentObject, QueryPart queryPart) throws QueryException, BimserverDatabaseException { super(queryContext, queryObjectProvider, queryPart); this.include = include; this.currentObject = currentObject; List<EReference> features = include.getFields(); List<EReference> featuresDirect = include.getFieldsDirect(); if ((features == null || features.isEmpty()) && (featuresDirect == null || featuresDirect.isEmpty())) { setDone(true);/*from ww w .j a v a 2 s . com*/ return; } if (features == null) { featureIterator = featuresDirect.iterator(); directFeatureSet = new HashSet<>(featuresDirect); } else if (featuresDirect == null) { featureIterator = features.iterator(); } else { featureIterator = Iterators.concat(features.iterator(), featuresDirect.iterator()); } if (include.getOutputTypes() != null) { this.outputFilterCids = new HashSet<>(); for (EClass eClass : include.getOutputTypes()) { short cid = queryObjectProvider.getDatabaseSession().getCidOfEClass(eClass); outputFilterCids.add(cid); } } }
From source file:org.sonar.pickbasic.tree.impl.statement.CaseClauseTreeImpl.java
@Override public Iterator<Tree> childrenIterator() { return Iterators.concat(Iterators.forArray(caseKeyword, expression, colon), statements.iterator()); }
From source file:org.apache.jackrabbit.oak.plugins.index.aggregate.AggregationCursor.java
private void fetchNext() { if (aggregates != null && aggregates.hasNext()) { currentPath = aggregates.next(); init = true;/*w ww . j a v a2 s . c o m*/ return; } aggregates = null; if (cursor.hasNext()) { currentRow = cursor.next(); if (!currentRow.isVirtualRow()) { String path = currentRow.getPath(); aggregates = Iterators.filter( Iterators.concat(Iterators.singletonIterator(path), aggregator.getParents(rootState, path)), Predicates.not(Predicates.in(seenPaths))); } fetchNext(); return; } closed = true; }
From source file:edu.byu.nlp.util.Collections3.java
/** * Creates a new collection that is logically the concatenation of the provided collections. The returned collection * is a view over the original two./* w w w. jav a 2s.co m*/ */ public static <E> Collection<E> concat(final Collection<E> coll1, final Collection<E> coll2) { return new AbstractCollection<E>() { @Override public Iterator<E> iterator() { return Iterators.concat(coll1.iterator(), coll2.iterator()); } @Override public int size() { return coll1.size() + coll2.size(); } }; }