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(Iterable<? extends T> a, Iterable<? extends T> b,
        Iterable<? extends T> c) 

Source Link

Document

Combines three iterables into a single iterable.

Usage

From source file:de.tuberlin.uebb.jdae.examples.BouncingBallArray.java

@Override
public Collection<Equation> initialEquations() {
    return ImmutableList.copyOf(Iterables.concat(balls[0].initialEquations(), balls[1].initialEquations(),
            balls[2].initialEquations()));
}

From source file:org.gradle.nativeplatform.toolchain.internal.msvcpp.Assembler.java

@Override
protected Iterable<String> buildPerFileArgs(List<String> genericArgs, List<String> sourceArgs,
        List<String> outputArgs, List<String> pchArgs) {
    if (pchArgs != null && !pchArgs.isEmpty()) {
        throw new UnsupportedOperationException(
                "Precompiled header arguments cannot be specified for a Assembler compiler.");
    }/*ww w .  j  a  va 2  s  .c  o  m*/
    // ml/ml64 have position sensitive arguments,
    // e.g., /Fo must appear before /c and /c must appear before the source file.

    return Iterables.concat(outputArgs, genericArgs, sourceArgs);
}

From source file:com.google.gerrit.server.mail.send.CreateChangeSender.java

@Override
protected void init() throws EmailException {
    super.init();

    boolean isDraft = change.getStatus() == Change.Status.DRAFT;
    try {/* w  w w  .jav  a2 s.co  m*/
        // Try to mark interested owners with TO and CC or BCC line.
        Watchers matching = getWatchers(NotifyType.NEW_CHANGES, !isDraft && !change.isPrivate());
        for (Account.Id user : Iterables.concat(matching.to.accounts, matching.cc.accounts,
                matching.bcc.accounts)) {
            if (isOwnerOfProjectOrBranch(user)) {
                add(RecipientType.TO, user);
            }
        }

        // Add everyone else. Owners added above will not be duplicated.
        add(RecipientType.TO, matching.to);
        add(RecipientType.CC, matching.cc);
        add(RecipientType.BCC, matching.bcc);
    } catch (OrmException err) {
        // Just don't CC everyone. Better to send a partial message to those
        // we already have queued up then to fail deliver entirely to people
        // who have a lower interest in the change.
        log.warn("Cannot notify watchers for new change", err);
    }

    includeWatchers(NotifyType.NEW_PATCHSETS, !isDraft && !change.isPrivate());
}

From source file:org.gradle.nativeplatform.toolchain.internal.msvcpp.WindowsResourceCompiler.java

@Override
protected Iterable<String> buildPerFileArgs(List<String> genericArgs, List<String> sourceArgs,
        List<String> outputArgs, List<String> pchArgs) {
    if (pchArgs != null && !pchArgs.isEmpty()) {
        throw new UnsupportedOperationException(
                "Precompiled header arguments cannot be specified for a Windows Resource compiler.");
    }//from   w ww.  j  a  va  2  s. c o m
    // RC has position sensitive arguments, the output args need to appear before the source file
    return Iterables.concat(genericArgs, outputArgs, sourceArgs);
}

From source file:de.tuberlin.uebb.jdae.examples.BouncingBallArray.java

@Override
public Collection<Equation> equations() {
    return ImmutableList
            .copyOf(Iterables.concat(balls[2].equations(), balls[1].equations(), balls[0].equations()));
}

From source file:msi.gama.common.util.JavaUtils.java

public static List<Class> collectImplementationClasses(final Class baseClass,
        final Iterable<Class<? extends ISkill>> skillClasses, final Set<Class> in) {
    final int key = keyOf(baseClass, skillClasses);
    if (!IMPLEMENTATION_CLASSES.containsKey(key)) {
        final Iterable<Class> basis = Iterables.concat(Collections.singleton(baseClass), skillClasses,
                allInterfacesOf(baseClass, in));
        final Iterable<Class> extensions = Iterables
                .concat(Iterables.transform(basis, each -> allSuperclassesOf(each, in)));
        final Set<Class> classes = Sets.newHashSet(Iterables.concat(basis, extensions));
        final ArrayList<Class> classes2 = new ArrayList(classes);
        Collections.sort(classes2, (o1, o2) -> {
            if (o1 == o2) {
                return 0;
            }//from  www  . ja va2  s  .c o m
            if (o1.isAssignableFrom(o2)) {
                return -1;
            }
            if (o2.isAssignableFrom(o1)) {
                return 1;
            }
            if (o1.isInterface() && !o2.isInterface()) {
                return -1;
            }
            if (o2.isInterface() && !o1.isInterface()) {
                return 1;
            }
            return 1;
        });

        IMPLEMENTATION_CLASSES.put(key, classes2);
    }
    return IMPLEMENTATION_CLASSES.get(key);

}

From source file:edu.byu.nlp.classify.eval.Predictions.java

public Iterable<? extends Prediction> allPredictions() {
    return Iterables.concat(labeledPredictions, unlabeledPredictions, heldoutPredictions);
}

From source file:org.sonar.java.model.statement.BreakStatementTreeImpl.java

@Override
public Iterable<Tree> children() {
    return Iterables.concat(Collections.singletonList(breakToken),
            label != null ? Collections.singletonList(label) : Collections.<Tree>emptyList(),
            Collections.<Tree>singletonList(semicolonToken));
}

From source file:org.sonar.java.model.statement.CaseLabelTreeImpl.java

@Override
public Iterable<Tree> children() {
    return Iterables.concat(Collections.singletonList(caseOrDefaultKeyword),
            expression != null ? Collections.singletonList(expression) : Collections.<Tree>emptyList(),
            Collections.singletonList(colonToken));
}

From source file:org.sonar.java.model.statement.ContinueStatementTreeImpl.java

@Override
public Iterable<Tree> children() {
    return Iterables.concat(Collections.singletonList(continueKeyword),
            label != null ? Collections.singletonList(continueKeyword) : Collections.<Tree>emptyList(),
            Collections.singletonList(semicolonToken));
}