public abstract class Multiplexing extends Object
| Constructor and Description |
|---|
Multiplexing() |
| Modifier and Type | Method and Description |
|---|---|
static <E> Iterator<List<E>> |
batch(int batchSize,
E[] array)
Demultiplexes elements from the source array into an iterator of
channels.
|
static <C extends Collection<E>,E> |
batch(int batchSize,
E[] array,
Provider<C> channelProvider)
Demultiplexes elements from the source array into an iterator of
channels.
|
static <E> Iterator<List<E>> |
batch(int batchSize,
Iterable<E> iterable)
Demultiplexes elements from the source iterable into an iterator of
channels.
|
static <C extends Collection<E>,E> |
batch(int batchSize,
Iterable<E> iterable,
Provider<C> channelProvider)
Demultiplexes elements from the source iterable into an iterator of
channels.
|
static <E> Iterator<List<E>> |
batch(int batchSize,
Iterator<E> iterator)
Demultiplexes elements from the source iterator into an iterator of
channels.
|
static <C extends Collection<E>,E> |
batch(int batchSize,
Iterator<E> iterator,
Provider<C> channelProvider)
Demultiplexes elements from the source iterator into an iterator of
channels.
|
static <E,I extends Iterator<E>> |
chain(I first,
I second)
Flattens passed iterators of E to an iterator of E.
|
static <E,I extends Iterator<E>> |
chain(I first,
I second,
I third)
Flattens passed iterators of E to an iterator of E.
|
static <E,I extends Iterator<E>> |
chain(Iterable<I> iterable)
Flattens an iterable of iterators of E to an iterator of E.
|
static <E,I extends Iterator<E>> |
chain(Iterator<I> iterators)
Flattens an iterator of iterators of E to an iterator of E.
|
static <E> Iterator<E> |
cycle(E first,
E second)
Creates an infinite iterator that issues elements from the parameter
cyclicly.
|
static <E> Iterator<E> |
cycle(E first,
E second,
E third)
Creates an infinite iterator that issues elements from the parameter
cyclicly.
|
static <E> Iterator<E> |
cycle(Iterable<E> iterable)
Creates an infinite iterator that issues elements from the parameter
cyclicly.
|
static <E> Iterator<E> |
cycle(Iterator<E> iterator)
Creates an infinite iterator that issues elements from the parameter
cyclicly.
|
static <E,I extends Iterable<E>> |
flatten(I first,
I second)
Flattens passed iterables of E to an iterator of E.
|
static <E,I extends Iterable<E>> |
flatten(I first,
I second,
I third)
Flattens passed iterables of E to an iterator of E.
|
static <E,I extends Iterable<E>> |
flatten(Iterable<I> iterables)
Flattens an iterable of iterables of E to an iterator of E.E.g:
flatten([1,2], [3,4]) -> [1,2,3,4]
|
static <E,I extends Iterable<E>> |
flatten(Iterator<I> iterables)
Flattens an iterator of iterables of E to an iterator of E.
|
static <E,I extends Iterator<E>> |
roundrobin(Iterable<I> iterable)
Multiplexes an iterator of iterators into an iterator.
|
static <E> Iterator<E> |
roundrobin(Iterator<E> first,
Iterator<E> second)
Multiplexes an iterator of iterators into an iterator.
|
static <E> Iterator<E> |
roundrobin(Iterator<E> first,
Iterator<E> second,
Iterator<E> third)
Multiplexes an iterator of iterators into an iterator.
|
static <E,I extends Iterator<E>> |
roundrobin(Iterator<I> iterators)
Multiplexes an iterator of iterators into an iterator.
|
static <E,I extends Iterator<E>> |
roundrobinLongest(Iterable<I> iterable)
Multiplexes an iterable of iterators into a single iterator.
|
static <E> Iterator<Maybe<E>> |
roundrobinLongest(Iterator<E> first,
Iterator<E> second)
Multiplexes two iterators into a single iterator.
|
static <E> Iterator<Maybe<E>> |
roundrobinLongest(Iterator<E> first,
Iterator<E> second,
Iterator<E> third)
Multiplexes three iterators into a single iterator.
|
static <E,I extends Iterator<E>> |
roundrobinLongest(Iterator<I> iterators)
Multiplexes an iterator of iterators into a single iterator.
|
static <E,I extends Iterator<E>> |
roundrobinShortest(Iterable<I> iterable)
Multiplexes an iterable of iterators into a single iterator.
|
static <E> Iterator<E> |
roundrobinShortest(Iterator<E> first,
Iterator<E> second)
Multiplexes two iterators into a single iterator.
|
static <E> Iterator<E> |
roundrobinShortest(Iterator<E> first,
Iterator<E> second,
Iterator<E> third)
Multiplexes three iterators into a single iterator.
|
static <E,I extends Iterator<E>> |
roundrobinShortest(Iterator<I> iterators)
Multiplexes an iterator of iterators into a single iterator.
|
static <E> Iterator<List<E>> |
unchain(int channelSize,
E... array)
Demultiplexes elements from the source array into an iterator of
channels.
|
static <E> Iterator<List<E>> |
unchain(int channelSize,
Iterable<E> iterable)
Demultiplexes elements from the source iterable into an iterator of
channels.
|
static <C extends Collection<E>,E> |
unchain(int channelSize,
Iterable<E> iterable,
Provider<C> channelProvider)
Demultiplexes elements from the source iterable into an iterator of
channels.
|
static <E> Iterator<List<E>> |
unchain(int channelSize,
Iterator<E> iterator)
Demultiplexes elements from the source iterator into an iterator of
channels.
|
static <C extends Collection<E>,E> |
unchain(int channelSize,
Iterator<E> iterator,
Provider<C> channelProvider)
Demultiplexes elements from the source iterator into an iterator of
channels.
|
static <C extends Collection<E>,E> |
unchain(int channelSize,
Provider<C> channelProvider,
E... array)
Demultiplexes elements from the source array into an iterator of
channels.
|
static <E> Iterator<List<Maybe<E>>> |
unchainWithExactChannelSize(int channelSize,
E... array)
Demultiplexes elements from the source array into an iterator of
channels.
|
static <E> Iterator<List<Maybe<E>>> |
unchainWithExactChannelSize(int channelSize,
Iterable<E> iterable)
Demultiplexes elements from the source array into an iterator of
channels.
|
static <C extends Collection<Maybe<E>>,E> |
unchainWithExactChannelSize(int channelSize,
Iterable<E> iterable,
Provider<C> channelProvider)
Demultiplexes elements from the source array into an iterator of
channels.
|
static <E> Iterator<List<Maybe<E>>> |
unchainWithExactChannelSize(int channelSize,
Iterator<E> iterator)
Demultiplexes elements from the source array into an iterator of
channels.
|
static <C extends Collection<Maybe<E>>,E> |
unchainWithExactChannelSize(int channelSize,
Iterator<E> iterator,
Provider<C> channelProvider)
Demultiplexes elements from the source array into an iterator of
channels.
|
static <C extends Collection<Maybe<E>>,E> |
unchainWithExactChannelSize(int channelSize,
Provider<C> channelProvider,
E... array)
Demultiplexes elements from the source array into an iterator of
channels.
|
public static <E,I extends Iterable<E>> Iterator<E> flatten(Iterator<I> iterables)
flatten([1,2], [3,4]) -> [1,2,3,4]
E - the iterable element typeI - the iterable typeiterables - the iterator of iterables to be flattenedpublic static <E,I extends Iterable<E>> Iterator<E> flatten(Iterable<I> iterables)
flatten([1,2], [3,4]) -> [1,2,3,4]
E - the iterable element typeI - the iterable typeiterables - the iterable of iterables to be flattenedpublic static <E,I extends Iterable<E>> Iterator<E> flatten(I first, I second)
flatten([1,2], [3,4]) -> [1,2,3,4]
E - the iterable element typeI - the iterable typefirst - the first iterable to be flattenedsecond - the second iterable to be flattenedpublic static <E,I extends Iterable<E>> Iterator<E> flatten(I first, I second, I third)
flatten([1,2], [3,4], [5,6]) -> [1,2,3,4,5,6]
E - the iterable element typeI - the iterable typefirst - the first iterable to be flattenedsecond - the second iterable to be flattenedthird - the third iterable to be flattenedpublic static <E,I extends Iterator<E>> Iterator<E> chain(Iterator<I> iterators)
chain([1,2], [3,4]) -> [1,2,3,4]
E - the iterator element typeI - the iterator typeiterators - the source iteratorspublic static <E,I extends Iterator<E>> Iterator<E> chain(Iterable<I> iterable)
chain([1,2], [3,4]) -> [1,2,3,4]
E - the iterator element typeI - the iterator typeiterable - the source iterablepublic static <E,I extends Iterator<E>> Iterator<E> chain(I first, I second)
chain([1,2], [3,4]) -> [1,2,3,4]
E - the iterator element typeI - the iterator typefirst - the first iterator to be flattenedsecond - the second iterator to be flattenedpublic static <E,I extends Iterator<E>> Iterator<E> chain(I first, I second, I third)
chain([1,2], [3,4], [5,6]) -> [1,2,3,4,5,6]
E - the iterator element typeI - the iterator typefirst - the first iterator to be flattenedsecond - the second iterator to be flattenedthird - the third iterator to be flattenedpublic static <C extends Collection<E>,E> Iterator<C> batch(int batchSize, Iterator<E> iterator, Provider<C> channelProvider)
C - the channel collection typeE - the element typebatchSize - maximum size of the channeliterator - the source iteratorchannelProvider - a provider used to create channelspublic static <E> Iterator<List<E>> batch(int batchSize, Iterator<E> iterator)
E - the element typebatchSize - maximum size of the channeliterator - the source iteratorpublic static <C extends Collection<E>,E> Iterator<C> batch(int batchSize, Iterable<E> iterable, Provider<C> channelProvider)
C - the channel collection typeE - the element typebatchSize - maximum size of the channeliterable - the source iterablechannelProvider - the provider used to create channelspublic static <E> Iterator<List<E>> batch(int batchSize, Iterable<E> iterable)
E - the element typebatchSize - maximum size of the channeliterable - the source iterablepublic static <C extends Collection<E>,E> Iterator<C> batch(int batchSize, E[] array, Provider<C> channelProvider)
C - the channel collection typeE - the element typebatchSize - maximum size of the channelarray - the source arraychannelProvider - the provider used to create channelspublic static <E> Iterator<List<E>> batch(int batchSize, E[] array)
E - the element typebatchSize - maximum size of the channelarray - the source arraypublic static <E,I extends Iterator<E>> Iterator<E> roundrobin(Iterator<I> iterators)
roundRobin([1,2], [3], [4,5]) -> [1,3,4,2,5]
E - the element typeI - the iterator typeiterators - the source iteratorpublic static <E,I extends Iterator<E>> Iterator<E> roundrobin(Iterable<I> iterable)
roundRobin([1,2], [3], [4,5]) -> [1,3,4,2,5]
E - the element typeI - the iterator typeiterable - the source iterablepublic static <E> Iterator<E> roundrobin(Iterator<E> first, Iterator<E> second)
roundRobin([1,2], [3]) -> [1,3,2]
E - the element typefirst - the first source iteratorsecond - the second source iteratorpublic static <E> Iterator<E> roundrobin(Iterator<E> first, Iterator<E> second, Iterator<E> third)
roundRobin([1,2], [3], [4,5,6]) -> [1,3,4,2,5,6]
E - the element typefirst - the first source iteratorsecond - the second source iteratorthird - the third source iteratorpublic static <E,I extends Iterator<E>> Iterator<E> roundrobinShortest(Iterator<I> iterators)
roundrobinShortest([1,2,3], [4,5]) -> [1,4,2,5]
E - the element typeI - the iterator typeiterators - the iterator of iterators to be multiplexedpublic static <E,I extends Iterator<E>> Iterator<E> roundrobinShortest(Iterable<I> iterable)
roundrobinShortest([1,2,3], [4,5]) -> [1,4,2,5]
E - the element typeI - the source iterator typeiterable - the source iterablepublic static <E> Iterator<E> roundrobinShortest(Iterator<E> first, Iterator<E> second)
roundrobinShortest([1,2], [3]) -> [1,3]
E - the element typefirst - the first source iteratorsecond - the second source iteratorpublic static <E> Iterator<E> roundrobinShortest(Iterator<E> first, Iterator<E> second, Iterator<E> third)
roundrobinShortest([1,2], [3], [4]) -> [1, 3, 4]
E - the element typefirst - the first source iteratorsecond - the second source iteratorthird - the third source iteratorpublic static <E,I extends Iterator<E>> Iterator<Maybe<E>> roundrobinLongest(Iterator<I> iterators)
roundrobinLongest([1,2], [4]) -> [just 1, just 4, just 2, nothing]
E - the element typeI - the iterator typeiterators - the source iteratorpublic static <E,I extends Iterator<E>> Iterator<Maybe<E>> roundrobinLongest(Iterable<I> iterable)
roundrobinLongest([1,2], [4]) -> [just 1, just 4, just 2, nothing]
E - the element typeI - the iterator typeiterable - the source iterablepublic static <E> Iterator<Maybe<E>> roundrobinLongest(Iterator<E> first, Iterator<E> second)
roundrobinLongest([1,2], [4]) -> [just 1, just 4, just 2, nothing]
E - the element typefirst - the first source iteratorsecond - the second source iteratorpublic static <E> Iterator<Maybe<E>> roundrobinLongest(Iterator<E> first, Iterator<E> second, Iterator<E> third)
roundrobinLongest([1,2], [4], [5]) -> [just 1, just 4, just 5, just 2, nothing, nothing]
E - the element typefirst - the first source iteratorsecond - the second source iteratorthird - the third source iteratorpublic static <E> Iterator<E> cycle(Iterator<E> iterator)
E - the element typeiterator - the iterator to cyclepublic static <E> Iterator<E> cycle(Iterable<E> iterable)
E - the element typeiterable - the iterable to cyclepublic static <E> Iterator<E> cycle(E first, E second)
E - the element typefirst - the first element to consider while cyclingsecond - the second element to consider while cyclingpublic static <E> Iterator<E> cycle(E first, E second, E third)
E - the element typefirst - the first element to consider while cyclingsecond - the second element to consider while cyclingthird - the third element to consider while cyclingpublic static <C extends Collection<E>,E> Iterator<C> unchain(int channelSize, Iterator<E> iterator, Provider<C> channelProvider)
C - the channel collection typeE - the element typechannelSize - size of the channeliterator - the source iteratorchannelProvider - a provider used to create channelspublic static <E> Iterator<List<E>> unchain(int channelSize, Iterator<E> iterator)
E - the element typechannelSize - size of the channeliterator - the source iteratorpublic static <C extends Collection<E>,E> Iterator<C> unchain(int channelSize, Iterable<E> iterable, Provider<C> channelProvider)
C - the channel collection typeE - the element typechannelSize - size of the channeliterable - the source iterablechannelProvider - the provider used to create channelspublic static <E> Iterator<List<E>> unchain(int channelSize, Iterable<E> iterable)
E - the element typechannelSize - size of the channeliterable - the source iterablepublic static <C extends Collection<E>,E> Iterator<C> unchain(int channelSize, Provider<C> channelProvider, E... array)
C - the channel collection typeE - the element typechannelSize - size of the channelarray - the source arraychannelProvider - the provider used to create channelspublic static <E> Iterator<List<E>> unchain(int channelSize, E... array)
E - the element typechannelSize - size of the channelarray - the source arraypublic static <C extends Collection<Maybe<E>>,E> Iterator<C> unchainWithExactChannelSize(int channelSize, Iterator<E> iterator, Provider<C> channelProvider)
C - the channel collection typeE - the element typechannelSize - size of the channeliterator - the source iteratorchannelProvider - the provider used to create channelspublic static <E> Iterator<List<Maybe<E>>> unchainWithExactChannelSize(int channelSize, Iterator<E> iterator)
E - the element typechannelSize - size of the channeliterator - the source iteratorpublic static <C extends Collection<Maybe<E>>,E> Iterator<C> unchainWithExactChannelSize(int channelSize, Iterable<E> iterable, Provider<C> channelProvider)
C - the channel collection typeE - the element typechannelSize - size of the channeliterable - the source iterablechannelProvider - the provider used to create channelspublic static <E> Iterator<List<Maybe<E>>> unchainWithExactChannelSize(int channelSize, Iterable<E> iterable)
E - the element typechannelSize - size of the channeliterable - the source iterablepublic static <C extends Collection<Maybe<E>>,E> Iterator<C> unchainWithExactChannelSize(int channelSize, Provider<C> channelProvider, E... array)
C - the channel collection typeE - the element typechannelSize - size of the channelchannelProvider - the provider used to create channelsarray - the source arraypublic static <E> Iterator<List<Maybe<E>>> unchainWithExactChannelSize(int channelSize, E... array)
E - the element typechannelSize - size of the channelarray - the source arrayCopyright © 2012. All Rights Reserved.