Example usage for com.google.common.collect Iterables concat

List of usage examples for com.google.common.collect Iterables concat

Introduction

In this page you can find the example usage for com.google.common.collect Iterables concat.

Prototype

public static <T> Iterable<T> concat(final Iterable<? extends Iterable<? extends T>> inputs) 

Source Link

Document

Combines multiple iterables into a single iterable.

Usage

From source file:com.metamx.collections.spatial.search.GutmanSearchStrategy.java

public Iterable<ImmutablePoint> depthFirstSearch(ImmutableNode node, final Bound bound) {
    if (node.isLeaf()) {
        return bound
                .filter(Iterables.transform(node.getChildren(), new Function<ImmutableNode, ImmutablePoint>() {
                    @Override// w w  w  .ja  v  a  2s  .  com
                    public ImmutablePoint apply(ImmutableNode tNode) {
                        return new ImmutablePoint(tNode);
                    }
                }));
    } else {
        return Iterables.concat(
                Iterables.transform(Iterables.filter(node.getChildren(), new Predicate<ImmutableNode>() {
                    @Override
                    public boolean apply(ImmutableNode child) {
                        return bound.overlaps(child);
                    }
                }), new Function<ImmutableNode, Iterable<ImmutablePoint>>() {
                    @Override
                    public Iterable<ImmutablePoint> apply(ImmutableNode child) {
                        return depthFirstSearch(child, bound);
                    }
                }));
    }
}

From source file:de.up.ling.irtg.automata.index.MapTopDownIndex.java

@Override
public Iterable<Rule> getRules(int parentState) {
    processNewTopDownRules();//from  w  w  w.ja va 2 s .c om
    Int2ObjectMap<Set<Rule>> topdown = explicitRulesTopDown.get(parentState);

    if (topdown == null) {
        return Collections.emptyList();
    } else {
        return Iterables.concat(topdown.values());
    }
}

From source file:org.obeonetwork.dsl.uml2.design.tests.automation.common.ModelChangeRecorder.java

public Iterable<EObject> detachedObjects() {
    return Iterables.concat(Iterables.transform(
            Iterables.filter(changes, Predicates.and(Notifications.containmentRef, Notifications.deletion)),
            Notifications.toObjectValue));
}

From source file:org.eclipse.xtext.resource.impl.AbstractCompoundSelectable.java

@Override
public Iterable<IEObjectDescription> getExportedObjectsByObject(final EObject object) {
    return Iterables.concat(
            Iterables.transform(getSelectables(), new Function<ISelectable, Iterable<IEObjectDescription>>() {
                @Override//  w  ww  .j a va  2s  . c  o  m
                public Iterable<IEObjectDescription> apply(ISelectable from) {
                    if (from != null)
                        return from.getExportedObjectsByObject(object);
                    return Collections.emptyList();
                }
            }));
}

From source file:org.killbill.billing.junction.plumbing.billing.DefaultBillingEventSet.java

@Override
public Map<String, Usage> getUsages() {
    final Iterable<Usage> allUsages = Iterables
            .concat(Iterables.transform(this, new Function<BillingEvent, List<Usage>>() {
                @Override/*w w w . j  a va 2s  . c om*/
                public List<Usage> apply(final BillingEvent input) {
                    return input.getUsages();
                }
            }));
    if (!allUsages.iterator().hasNext()) {
        return Collections.emptyMap();
    }
    final Map<String, Usage> result = new HashMap<String, Usage>();
    for (Usage cur : Sets.<Usage>newHashSet(allUsages)) {
        result.put(cur.getName(), cur);
    }
    return result;
}

From source file:eu.numberfour.n4js.scoping.utils.CompositeScope.java

@Override
public Iterable<IEObjectDescription> getElements(EObject object) {
    return Iterables.concat(Arrays.stream(childScopes).map(currScope -> currScope.getElements(object))
            .collect(Collectors.toList()));
}

From source file:com.metamx.druid.index.v1.SpatialDimensionRowFormatter.java

public SpatialDimensionRowFormatter(List<SpatialDimensionSchema> spatialDimensions) {
    this.spatialDimensions = spatialDimensions;
    this.spatialDimNames = Sets
            .newHashSet(Lists.transform(spatialDimensions, new Function<SpatialDimensionSchema, String>() {
                @Override/*from ww w .j  a v  a 2 s  .c  o  m*/
                public String apply(SpatialDimensionSchema input) {
                    return input.getDimName();
                }
            }));
    this.spatialPartialDimNames = Sets.newHashSet(Iterables
            .concat(Lists.transform(spatialDimensions, new Function<SpatialDimensionSchema, List<String>>() {
                @Override
                public List<String> apply(SpatialDimensionSchema input) {
                    return input.getDims();
                }
            })));
}

From source file:org.adsync4j.unboundid.PagingLdapConnectionImpl.java

@Override
public Iterable<SearchResultEntry> search(final SearchRequest searchRequest, final int pageSize)
        throws LDAPException {
    searchRequest.replaceControl(new SimplePagedResultsControl(pageSize, null));

    LOG.debug("Requesting first page of results for search request: {}", searchRequest);
    final SearchResult firstPage = search(searchRequest);

    Iterable<List<SearchResultEntry>> pages = new Iterable<List<SearchResultEntry>>() {
        @Override/*from www.  j  a v a  2s  .c  o m*/
        public Iterator<List<SearchResultEntry>> iterator() {
            return new PagingSearchIterator(PagingLdapConnectionImpl.this, searchRequest, firstPage);
        }
    };
    return Iterables.concat(pages);
}

From source file:org.richfaces.cdk.templatecompiler.builder.model.JavaMethod.java

@Override
public Iterable<JavaImport> getRequiredImports() {
    Iterable<JavaImport> exceptionsImports = Iterables
            .concat(Iterables.transform(getExceptions(), RequireImports.IMPORTS_TRANSFORM));
    Iterable<JavaImport> argumentsImports = Iterables
            .concat(Iterables.transform(getArguments(), RequireImports.IMPORTS_TRANSFORM));
    Iterable<JavaImport> imports = Iterables.concat(getReturnType().getRequiredImports(), exceptionsImports,
            argumentsImports);/*from  w  ww  . jav  a2s.  c om*/
    if (null != getMethodBody()) {
        imports = Iterables.concat(imports, getMethodBody().getRequiredImports());
    }
    return imports;
}

From source file:io.druid.segment.incremental.SpatialDimensionRowFormatter.java

public SpatialDimensionRowFormatter(List<SpatialDimensionSchema> spatialDimensions) {
    this.spatialDimensionMap = Maps.newHashMap();
    for (SpatialDimensionSchema spatialDimension : spatialDimensions) {
        if (this.spatialDimensionMap.put(spatialDimension.getDimName(), spatialDimension) != null) {
            throw new ISE("Duplicate spatial dimension names found! Check your schema yo!");
        }/*from   w  ww.  ja  v a  2  s  .com*/
    }
    this.spatialPartialDimNames = Sets.newHashSet(Iterables
            .concat(Lists.transform(spatialDimensions, new Function<SpatialDimensionSchema, List<String>>() {
                @Override
                public List<String> apply(SpatialDimensionSchema input) {
                    return input.getDims();
                }
            })));
}