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:org.gradle.model.internal.core.ChainingModelProjection.java

private Iterable<String> collectDescriptions(final Function<ModelProjection, Iterable<String>> transformer) {
    return Iterables.concat(Iterables.transform(projections, transformer));
}

From source file:org.apache.crunch.util.UnionReadableData.java

@Override
public Iterable<T> read(final TaskInputOutputContext<?, ?, ?, ?> context) throws IOException {
    List<Iterable<T>> iterables = Lists.newArrayList();
    for (ReadableData<T> rd : data) {
        iterables.add(rd.read(context));
    }//from  w  ww .  j  a va2 s  .  co  m
    return Iterables.concat(iterables);
}

From source file:com.facebook.presto.util.IterableTransformer.java

public <T> IterableTransformer<T> transformAndFlatten(Function<? super E, ? extends Iterable<T>> function) {
    return new IterableTransformer<>(Iterables.concat(Iterables.transform(iterable, function)));
}

From source file:org.splevo.jamopp.refactoring.java.JaMoPPFullyAutomatedVariabilityRefactoring.java

@Override
protected void executeReplacement(Entry<EObject, EObject> replacement, VariationPoint variationPoint) {
    // collect all possible replacement targets
    Iterable<SoftwareElement> softwareElements = Iterables.concat(Iterables
            .transform(variationPoint.getVariants(), new Function<Variant, Iterable<SoftwareElement>>() {
                @Override//from w w w  .  j  ava  2  s  . c o m
                public Iterable<SoftwareElement> apply(Variant input) {
                    return input.getImplementingElements();
                }
            }));

    // execute the replacement or fall back to the default implementation.
    if (!executeReplacement(replacement, softwareElements)) {
        super.executeReplacement(replacement, variationPoint);
    }
}

From source file:org.elasticsearch.discovery.gce.mock.GceComputeServiceZeroNodeMock.java

@Override
public Collection<Instance> instances() {
    logger.debug("get instances for zoneList [{}]", zoneList);

    List<List<Instance>> instanceListByZone = Lists.transform(zoneList, new Function<String, List<Instance>>() {
        @Override/*from ww  w. ja va 2 s. c o  m*/
        public List<Instance> apply(String zoneId) {
            // If we return null here we will get a trace as explained in issue 43
            return new ArrayList();
        }
    });

    //Collapse instances from all zones into one neat list
    List<Instance> instanceList = Lists.newArrayList(Iterables.concat(instanceListByZone));

    if (instanceList.size() == 0) {
        logger.warn("disabling GCE discovery. Can not get list of nodes");
    }

    return instanceList;
}

From source file:com.metamx.common.guava.FunctionalIterable.java

public <RetType> FunctionalIterable<RetType> transformCat(Function<T, Iterable<RetType>> fn) {
    return new FunctionalIterable<>(Iterables.concat(Iterables.transform(delegate, fn)));
}

From source file:com.google.cloud.dataflow.sdk.util.state.MergedBag.java

@Override
public StateContents<Iterable<T>> get() {
    // Initiate the get's right away
    final List<StateContents<Iterable<T>>> futures = new ArrayList<>(sources.size());
    for (BagState<T> source : sources) {
        futures.add(source.get());//from  w  ww  .ja va  2  s  . c  o m
    }

    // But defer the actual reads until later.
    return new StateContents<Iterable<T>>() {
        @Override
        public Iterable<T> read() {
            List<Iterable<T>> allIterables = new ArrayList<>();
            for (StateContents<Iterable<T>> future : futures) {
                allIterables.add(future.read());
            }
            return Iterables.concat(allIterables);
        }
    };
}

From source file:org.testatoo.core.ListSelection.java

private ListSelection(Iterable<? extends Iterable<? extends T>> collections) {
    this.list = Lists.newArrayList(Iterables.concat(collections));
}

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

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

From source file:sg.atom.utils._beta.functional.FunctionalIterable.java

public <RetType> FunctionalIterable<RetType> transformCat(Function<T, Iterable<RetType>> fn) {
    return new FunctionalIterable<RetType>(Iterables.concat(Iterables.transform(delegate, fn)));
}