List of usage examples for com.google.common.collect Iterators concat
public static <T> Iterator<T> concat(final Iterator<? extends Iterator<? extends T>> inputs)
From source file:org.nickelproject.nickel.collections.InnerNode.java
@Override public CloseableIterator<T> iterator() { return TrivialCloseableIterator .create(Iterators.concat(Iterators.transform(Arrays.asList(nodes.get()).iterator(), new Function<DistributedCollection<T>, Iterator<T>>() { @Override public Iterator<T> apply(final DistributedCollection<T> input) { return input.iterator(); }//from w w w . ja va 2 s.c om }))); }
From source file:org.fcrepo.kernel.impl.rdf.impl.ChildrenRdfContext.java
private Iterator<Triple> childrenContext() { final Iterator<FedoraResource> niceChildren = resource().getChildren(); return Iterators.concat(Iterators.transform(niceChildren, child2triples())); }
From source file:org.apache.gobblin.util.request_allocation.GreedyAllocator.java
@Override protected Iterator<T> getJoinIterator(Iterator<? extends Requestor<T>> requestors, final ConcurrentBoundedPriorityIterable<T> requestIterable) { Iterator<T> unionIterator = Iterators .concat(Iterators.transform(requestors, new Function<Requestor<T>, Iterator<T>>() { @Nullable//from ww w .j ava 2s .c o m @Override public Iterator<T> apply(Requestor<T> input) { return input.iterator(); } })); return new InterruptibleIterator<>(unionIterator, new Callable<Boolean>() { @Override public Boolean call() throws Exception { return requestIterable.isFull(); } }); }
From source file:sg.atom.utils._beta.functional.FunctionalIterator.java
public <RetType> FunctionalIterator<RetType> transformCat(Function<T, Iterator<RetType>> fn) { return new FunctionalIterator<RetType>(Iterators.concat(Iterators.transform(delegate, fn))); }
From source file:io.crate.operation.join.CollectingPageableTaskIterable.java
@Override public Iterator<Object[]> iterator() { return Iterators.concat(Lists.transform(pages, new Function<Page, Iterator<Object[]>>() { @Nullable/* ww w . j a v a 2s . c o m*/ @Override public Iterator<Object[]> apply(@Nullable Page input) { if (input == null) { return Collections.emptyIterator(); } else { return input.iterator(); } } }).iterator()); }
From source file:org.fcrepo.kernel.impl.rdf.impl.ReferencesRdfContext.java
private Iterator<Triple> putStrongReferencePropertiesIntoContext() throws RepositoryException { final Iterator<Property> properties = resource().getNode().getReferences(); return Iterators.concat(Iterators.transform(properties, property2triple)); }
From source file:org.fcrepo.kernel.impl.rdf.impl.BlankNodeRdfContext.java
/** * Default constructor./*from ww w . j a v a 2s. c om*/ * * @param resource the resource * @param idTranslator the idTranslator * @throws javax.jcr.RepositoryException if repository exception occurred */ public BlankNodeRdfContext(final FedoraResource resource, final IdentifierConverter<Resource, FedoraResource> idTranslator) throws RepositoryException { super(resource, idTranslator); concat(Iterators.concat(Iterators.transform(getBlankNodesIterator(), new Function<Node, RdfStream>() { @Override public RdfStream apply(final Node node) { final FedoraResource resource = nodeConverter.convert(node); return resource.getTriples(idTranslator, ImmutableList.of(TypeRdfContext.class, PropertiesRdfContext.class, BlankNodeRdfContext.class)); } }))); }
From source file:org.jboss.weld.event.GlobalObserverNotifierService.java
private static Iterable<ObserverMethod<?>> createGlobalObserverMethodIterable( final Set<BeanManagerImpl> beanManagers) { return new Iterable<ObserverMethod<?>>() { @Override/*from w ww .j av a 2s .com*/ public Iterator<ObserverMethod<?>> iterator() { Iterator<Iterator<ObserverMethod<?>>> observerMethodIterators = Iterators .transform(beanManagers.iterator(), new BeanManagerToObserverMethodIterable()); return Iterators.concat(observerMethodIterators); } }; }
From source file:io.druid.java.util.common.guava.FunctionalIterator.java
public <RetType> FunctionalIterator<RetType> transformCat(Function<T, Iterator<RetType>> fn) { return new FunctionalIterator<>(Iterators.concat(Iterators.transform(delegate, fn))); }
From source file:org.apache.calcite.adapter.elasticsearch.Scrolling.java
/** * Combines lazily multiple {@link ElasticsearchJson.Result} into a single iterator of * {@link ElasticsearchJson.SearchHit}./*from w w w. ja v a2s. c o m*/ */ private static Iterator<ElasticsearchJson.SearchHit> flatten(Iterator<ElasticsearchJson.Result> results) { final Iterator<Iterator<ElasticsearchJson.SearchHit>> inputs = Iterators.transform(results, input -> input.searchHits().hits().iterator()); return Iterators.concat(inputs); }