List of usage examples for com.google.common.collect Iterables cycle
public static <T> Iterable<T> cycle(T... elements)
From source file:cc.ilo.cc.ilo.pipeline.Main.java
public static void main(String[] args) { PipeProvider<String, String> provider = new PipeProvider<String, String>() { @Override//from w w w . j a v a 2 s .co m public SimplePipe<String, String> createPipeInstance() { return new SimplePipe<String, String>() { @Override public Optional<String> process(String input) { try { Thread.sleep(500); } catch (InterruptedException e) { e.printStackTrace(); } return Optional.of(input + "."); } }; } }; Producer<String> producer = new IterableProducer<>(Iterables.cycle("I hate Gulash foreveeer".split(" "))); /* PullingPipelineBuilder .create(producer) .pipe(provider,2,2) .build() .run();*/ PipeProvider<String, String> duplicate = new PipeProvider<String, String>() { @Override public SimplePipe<String, String> createPipeInstance() { return new SimplePipe<String, String>() { @Override public Optional<String> process(String input) throws Exception { return Optional.of(input + input); } }; } }; CompositePipeBuilder<String, String> builder = CompositePipeBuilder.create(provider.createPipeInstance()); AbstractPipe<String, String> p = builder.pipe(provider.createPipeInstance()) .pipe(duplicate.createPipeInstance()).build(); try { System.err.println(p.process("foolong")); } catch (Exception e) { e.printStackTrace(); } }
From source file:com.magnet.mmx.server.plugin.mmxmgmt.util.SqlUtil.java
public static String getQs(int num) { return Joiner.on(", ").join(Iterables.limit(Iterables.cycle("?"), num)); }
From source file:org.apache.james.transport.mailets.remote.delivery.Repeat.java
public static <T> List<T> repeat(T element, int times) { Preconditions.checkArgument(times >= 0, "Times argument should be strictly positive"); return ImmutableList.copyOf(Iterables.limit(Iterables.cycle(element), times)); }
From source file:org.apache.james.transport.mailets.remoteDelivery.Repeat.java
@SuppressWarnings("unchecked") public static <T> List<T> repeat(T element, int times) { Preconditions.checkArgument(times >= 0, "Times argument should be strictly positive"); return ImmutableList.copyOf(Iterables.limit(Iterables.cycle(element), times)); }
From source file:uk.ac.ebi.atlas.profiles.differential.rnaseq.ExpressionsRowDeserializerRnaSeq.java
ExpressionsRowDeserializerRnaSeq(List<Contrast> orderedContrasts) {
this.expectedContrasts = Iterables.cycle(orderedContrasts).iterator();
}
From source file:co.cask.cdap.internal.app.queue.RoundRobinQueueReader.java
public RoundRobinQueueReader(Iterable<QueueReader<T>> readers) { this.readers = Iterables.cycle(readers).iterator(); }
From source file:com.facebook.buck.cxx.toolchain.ClangPreprocessor.java
@Override public final Iterable<String> localIncludeArgs(Iterable<String> includeRoots) { return MoreIterables.zipAndConcat(Iterables.cycle("-I"), Iterables.transform(includeRoots, MorePaths::pathWithUnixSeparators)); }
From source file:com.facebook.buck.cxx.ClangPreprocessor.java
@Override public final Iterable<String> localIncludeArgs(Iterable<String> includeRoots) { return MoreIterables.zipAndConcat(Iterables.cycle("-I"), includeRoots); }
From source file:uk.ac.ebi.atlas.profiles.differential.microarray.ExpressionsRowDeserializerMicroarray.java
ExpressionsRowDeserializerMicroarray(List<Contrast> orderedContrasts) { this.expectedContrasts = Iterables.cycle(orderedContrasts).iterator(); this.orderedContrasts = orderedContrasts; }
From source file:com.facebook.buck.cxx.ClangPreprocessor.java
@Override public final Iterable<String> systemIncludeArgs(Iterable<String> includeRoots) { return MoreIterables.zipAndConcat(Iterables.cycle("-isystem"), includeRoots); }