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:hu.petabyte.redflags.engine.scope.YearListScope.java

public YearListScope(List<Integer> years, MaxNumberDeterminer mnd) {
    checkNotNull(years, "years should not be null.");
    checkArgument(!years.isEmpty(), "years should not be empty.");
    checkNotNull(mnd, "mnd should not be null.");
    Collections.sort(years);//from   www.  j a  va 2  s. c o m
    this.years = years;
    List<SingleYearScope> singleYears = new ArrayList<SingleYearScope>();
    for (int y : years) {
        singleYears.add(new SingleYearScope(y, mnd));
    }
    it = Iterables.concat(singleYears).iterator(); // guava magic :-)
}

From source file:org.jclouds.vcloud.functions.CatalogItemsInOrg.java

@Override
public Iterable<CatalogItem> apply(Org from) {
    return Iterables.concat(Iterables.transform(allCatalogsInOrg.apply(from),
            new Function<Catalog, Iterable<? extends CatalogItem>>() {
                @Override//from   w w  w.  ja v  a  2 s  .  c  om
                public Iterable<? extends CatalogItem> apply(Catalog from) {
                    return allCatalogItemsInCatalog.apply(from);
                }

            }));
}

From source file:org.polarsys.reqcycle.types.impl.TypesManager.java

@Override
public Iterable<IType> getAllTypes() {
    Iterable<Iterable<IType>> transform = Iterables.transform(providers, new ProviderToITypes());
    Iterable<IType> result = Iterables.concat(transform);
    return Iterables.unmodifiableIterable(Iterables.concat(allTypes.values(), result));
}

From source file:com.github.rodionmoiseev.c10n.tools.search.DefaultC10NInterfaceSearch.java

private Set<URL> getPackageURLs(String... packagePrefixes) {
    Iterable<URL> packages = Iterables
            .concat(Iterables.transform(Arrays.asList(packagePrefixes), new Function<String, Set<URL>>() {
                @Override/* w  ww . jav a  2 s  . c  o  m*/
                public Set<URL> apply(String prefix) {
                    return ClasspathHelper.forPackage(prefix);
                }
            }));

    return Sets.newHashSet(packages);
}

From source file:org.jclouds.vcloud.director.v1_5.functions.AllCatalogItemsInOrg.java

@Override
public Iterable<CatalogItem> apply(Org from) {
    return Iterables.concat(
            Iterables.transform(allCatalogsInOrg.apply(from), new Function<Catalog, Iterable<CatalogItem>>() {
                @Override/*w  ww  . ja v  a2 s  .  co  m*/
                public Iterable<CatalogItem> apply(Catalog from) {
                    return allCatalogItemsInCatalog.apply(from);
                }

            }));
}

From source file:com.facebook.buck.cxx.CxxFlags.java

public static ImmutableList<String> getFlags(ImmutableList<String> flags,
        PatternMatchedCollection<ImmutableList<String>> platformFlags, CxxPlatform platform) {
    return FluentIterable.from(flags)
            .append(Iterables.concat(platformFlags.getMatchingValues(platform.getFlavor().toString())))
            .transform(getTranslateMacrosFn(platform)).toList();
}

From source file:com.comphenix.xp.parser.Utility.java

/**
 * Aggregates every element in a list of lists into a single list.
 * @param list - list of lists to aggregate.
 * @return List containing the element of each list in the given list.
 *///from   w w w  .  j av  a2  s .  c o m
public static <T> List<T> flatten(List<Set<T>> list) {
    return Lists.newArrayList(Iterables.concat(list));
}

From source file:org.elasticsearch.indices.flush.IndicesSyncedFlushResult.java

public IndicesSyncedFlushResult(Map<String, List<ShardsSyncedFlushResult>> shardsResultPerIndex) {
    this.shardsResultPerIndex = ImmutableMap.copyOf(shardsResultPerIndex);
    this.shardCounts = calculateShardCounts(Iterables.concat(shardsResultPerIndex.values()));
}

From source file:org.calrissian.flowmix.example.JoinExample.java

@Override
public List<Flow> getFlows() {
    Flow flow = new FlowBuilder().id("flow").flowDefs().stream("stream1").each().function(new Function() {
        @Override//from   w  ww .j  a  v a  2 s .  c o  m
        public List<Event> execute(Event event) {
            Event newEvent = new BaseEvent(event.getId(), event.getTimestamp());
            newEvent.putAll(Iterables.concat(event.getTuples()));
            newEvent.put(new Tuple("stream", "stream1"));
            return singletonList(newEvent);
        }
    }).end().endStream(false, "stream3") // send ALL results to stream2 and not to standard output
            .stream("stream2") // don't read any events from standard input
            .each().function(new Function() {
                @Override
                public List<Event> execute(Event event) {
                    Event newEvent = new BaseEvent(event.getId(), event.getTimestamp());
                    newEvent.putAll(Iterables.concat(event.getTuples()));
                    newEvent.put(new Tuple("stream", "stream2"));
                    return singletonList(newEvent);
                }
            }).end().endStream(false, "stream3").stream("stream3", false).join("stream1", "stream2")
            .evict(Policy.TIME, 5).end().endStream().endDefs().createFlow();

    return asList(new Flow[] { flow });
}

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

@Override
public Iterable<IEObjectDescription> getExportedObjectsByType(final EClass type) {
    return Iterables.concat(
            Iterables.transform(getSelectables(), new Function<ISelectable, Iterable<IEObjectDescription>>() {
                @Override/*from   ww  w. jav a2 s. c  o m*/
                public Iterable<IEObjectDescription> apply(ISelectable from) {
                    if (from != null)
                        return from.getExportedObjectsByType(type);
                    return Collections.emptyList();
                }
            }));
}