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

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

Introduction

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

Prototype

public static <T> Iterable<T> cycle(T... elements) 

Source Link

Document

Returns an iterable whose iterators cycle indefinitely over the provided elements.

Usage

From source file:com.facebook.buck.cxx.toolchain.ClangPreprocessor.java

@Override
public final Iterable<String> systemIncludeArgs(Iterable<String> includeRoots) {
    return MoreIterables.zipAndConcat(Iterables.cycle("-isystem"),
            Iterables.transform(includeRoots, MorePaths::pathWithUnixSeparators));
}

From source file:uk.ac.ebi.atlas.profiles.baseline.ExpressionsRowDeserializerBaseline.java

public ExpressionsRowDeserializerBaseline(List<FactorGroup> orderedFactorGroups) {
    expectedNumberOfValues = orderedFactorGroups.size();
    factorGroups = Iterables.cycle(orderedFactorGroups).iterator();
}

From source file:org.opendaylight.fpc.utils.AbstractThreadPool.java

/**
 * Main Constructor.// ww w.  j  ava 2s . com
 * @param db - Data Broker
 * @param poolSize - Thread pool size
 */
public AbstractThreadPool(DataBroker db, int poolSize) {
    this.poolSize = poolSize;
    this.db = db;
    this.startSignal = new CountDownLatch(1);
    this.pool = new ArrayList<T>();
    this.threadPool = new ArrayList<Thread>();
    this.it = Iterables.cycle(pool).iterator();
    atomicInt = new AtomicInteger(0);
}

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

@Override
public final Iterable<String> quoteIncludeArgs(Iterable<String> includeRoots) {
    return MoreIterables.zipAndConcat(Iterables.cycle("-iquote"), includeRoots);
}

From source file:com.facebook.buck.cxx.toolchain.ClangPreprocessor.java

@Override
public final Iterable<String> quoteIncludeArgs(Iterable<String> includeRoots) {
    return MoreIterables.zipAndConcat(Iterables.cycle("-iquote"),
            Iterables.transform(includeRoots, MorePaths::pathWithUnixSeparators));
}

From source file:de.Keyle.MyPet.skill.skills.Behavior.java

public Behavior(boolean addedByInheritance) {
    super(addedByInheritance);
    activeBehaviors.add(Normal);
    behaviorCycler = Iterables.cycle(activeBehaviors).iterator();
}

From source file:de.kussm.direction.Directions.java

public Directions repeat(int n) {
    return new Directions(Iterables.concat(Iterables.limit(Iterables.cycle(directions), n)));
}

From source file:com.facebook.buck.ocaml.OcamlCCompileStep.java

@Override
protected ImmutableList<String> getShellCommandInternal(ExecutionContext context) {
    ImmutableList.Builder<String> cmd = ImmutableList.<String>builder()
            .addAll(args.ocamlCompiler.getCommandPrefix(resolver)).addAll(OcamlCompilables.DEFAULT_OCAML_FLAGS);

    if (args.stdlib.isPresent()) {
        cmd.add("-nostdlib", OcamlCompilables.OCAML_INCLUDE_FLAG, args.stdlib.get());
    }/*from w  w  w.  j  a  v a  2 s  .  c  om*/

    return cmd.add("-cc", args.cCompiler.get(0))
            .addAll(MoreIterables.zipAndConcat(Iterables.cycle("-ccopt"),
                    args.cCompiler.subList(1, args.cCompiler.size())))
            .add("-c").add("-annot").add("-bin-annot").add("-o", args.output.toString()).add("-ccopt", "-Wall")
            .add("-ccopt", "-Wextra").add("-ccopt", String.format("-o %s", args.output.toString()))
            .addAll(args.flags).add(resolver.getAbsolutePath(args.input).toString()).build();
}

From source file:uk.co.unclealex.executable.example.ExampleGuiceCommand.java

/**
 * Print a message to the user./*from   ww  w .j  a  v a2 s  .c  om*/
 */
@Executable(GuiceModule.class)
public void run(ExampleGuiceCommandLine exampleGuiceCommandLine) {
    Iterable<String> messages = Iterables.limit(Iterables.cycle(getMessageProvider().getMessage()),
            exampleGuiceCommandLine.getRepititions());
    getStdout().println(Joiner.on('\n').join(messages));
}

From source file:de.kussm.direction.Directions.java

public Directions repeat() {
    return new Directions(Iterables.cycle(directions));
}