public final class InfiniteStreams extends Object
| Constructor and Description |
|---|
InfiniteStreams() |
| Modifier and Type | Method and Description |
|---|---|
static Stream<Integer> |
getInfiniteCountingStream(int start,
int step)
returns a infinite stream which counts
|
static Stream<Integer> |
getInfiniteModuloStream(int start,
int step,
int mod)
returns a infinite stream which counts and calculates modulo
|
static Stream<Float> |
getInfinteRandomStream()
returns a infinite stream with random numbers
|
static <T> Stream<T> |
getQueueStream(BlockingQueue<T> queue)
Gets infinite queue working stream
|
static <T> Collection<Thread> |
workQueueStream(BlockingQueue<T> queue,
Consumer<Stream<T>> streamStack,
int threads)
Creates some threads which poll the given queue and work down the stack
|
public static Stream<Integer> getInfiniteCountingStream(int start, int step)
start - - start elementstep - - counting steppublic static Stream<Integer> getInfiniteModuloStream(int start, int step, int mod)
start - - start elementmod - - modulo factorstep - - counting steppublic static Stream<Float> getInfinteRandomStream()
public static <T> Stream<T> getQueueStream(BlockingQueue<T> queue)
queue - - target queuepublic static <T> Collection<Thread> workQueueStream(BlockingQueue<T> queue, Consumer<Stream<T>> streamStack, int threads)
queue - streamStack - threads - Copyright © 2014–2015. All rights reserved.