public abstract class Filtering extends Object
| Constructor and Description |
|---|
Filtering() |
| Modifier and Type | Method and Description |
|---|---|
static <E> Iterator<E> |
atMostLast(int howMany,
E[] from)
Creates an iterator yielding at most last n elements from the source
array.
|
static <E> Iterator<E> |
atMostLast(int howMany,
Iterable<E> from)
Creates an iterator yielding at most last n elements from the source
iterable.
|
static <E> Iterator<E> |
atMostLast(int howMany,
Iterator<E> from)
Creates an iterator yielding at most last n elements from the source
iterator.
|
static <E> Iterator<E> |
drop(long howMany,
E... array)
Creates an iterator yielding all but first n elements from the passed
array.
|
static <E> Iterator<E> |
drop(long howMany,
Iterable<E> iterable)
Creates an iterator yielding all but first n elements from the passed
iterable.
|
static <E> Iterator<E> |
drop(long howMany,
Iterator<E> iterator)
Creates an iterator yielding all but first n elements from the passed
iterator.
|
static <E> Iterator<E> |
dropWhile(E[] array,
Predicate<E> predicate)
Creates an iterator yielding values from the source array up until the
passed predicate doesn't match.
|
static <E> Iterator<E> |
dropWhile(Iterable<E> iterable,
Predicate<E> predicate)
Creates an iterator yielding values from the source iterable up until the
passed predicate doesn't match.
|
static <E> Iterator<E> |
dropWhile(Iterator<E> iterator,
Predicate<E> predicate)
Creates an iterator yielding values from the source iterator up until the
passed predicate doesn't match.
|
static <E> Iterator<E> |
filter(E[] array,
Predicate<E> predicate)
Creates an iterator yielding elements from the source array matching the
given predicate.
|
static <E> Iterator<E> |
filter(Iterable<E> iterable,
Predicate<E> predicate)
Creates an iterator yielding elements from the source iterable matching
the given predicate.
|
static <E> Iterator<E> |
filter(Iterator<E> iterator,
Predicate<E> predicate)
Creates an iterator yielding elements from the source iterator matching
the given predicate.
|
static <E> Iterator<E> |
slice(long from,
long howMany,
E... array)
Creates an iterator yielding a slice of the source array.
|
static <E> Iterator<E> |
slice(long from,
long howMany,
Iterable<E> iterable)
Creates an iterator yielding a slice of the source iterable.
|
static <E> Iterator<E> |
slice(long from,
long howMany,
Iterator<E> iterator)
Creates an iterator yielding a slice of the source iterator.
|
static <E> Iterator<E> |
take(long howMany,
E... array)
Creates an iterator yielding at most first n elements of the passed
array.
|
static <E> Iterator<E> |
take(long howMany,
Iterable<E> iterable)
Creates an iterator yielding at most first n elements of the passed
iterable.
|
static <E> Iterator<E> |
take(long howMany,
Iterator<E> iterator)
Creates an iterator yielding at most first n elements of the passed
iterator.
|
static <E> Iterator<E> |
takeLast(int howMany,
E[] from)
Creates an iterator yielding last n elements from the source array.
|
static <E> Iterator<E> |
takeLast(int howMany,
Iterable<E> from)
Creates an iterator yielding last n elements from the source iterable.
|
static <E> Iterator<E> |
takeLast(int howMany,
Iterator<E> from)
Creates an iterator yielding last n elements from the source iterator.
|
static <E> Iterator<E> |
takeWhile(E[] array,
Predicate<E> predicate)
Creates an iterator yielding values from the source array up until the
passed predicate matches.
|
static <E> Iterator<E> |
takeWhile(Iterable<E> iterable,
Predicate<E> predicate)
Creates an iterator yielding values from the source iterable up until the
passed predicate matches.
|
static <E> Iterator<E> |
takeWhile(Iterator<E> iterator,
Predicate<E> predicate)
Creates an iterator yielding values from the source iterator up until the
passed predicate matches.
|
public static <E> Iterator<E> filter(Iterator<E> iterator, Predicate<E> predicate)
filter([1,2,3,4], isEven) -> [2,4]E - the iterator element typeiterator - the iterator where elements are fetched frompredicate - the predicate applied to each elementpublic static <E> Iterator<E> filter(Iterable<E> iterable, Predicate<E> predicate)
filter([1,2,3,4], isEven) -> [2,4]E - the iterable element typeiterable - the iterable where elements are fetched frompredicate - the predicate applied to each elementpublic static <E> Iterator<E> filter(E[] array, Predicate<E> predicate)
filter([1,2,3,4], isEven) -> [2,4]E - the array element typearray - the array where elements are fetched frompredicate - the predicate applied to each elementpublic static <E> Iterator<E> takeLast(int howMany, Iterable<E> from)
takeLast(2, [1, 2, 3]) -> [2, 3]E - the iterable element typehowMany - number of elements to be yieldedfrom - the source iterablepublic static <E> Iterator<E> takeLast(int howMany, Iterator<E> from)
takeLast(2, [1, 2, 3]) -> [2, 3]E - the iterator element typehowMany - number of elements to be yieldedfrom - the source iteratorpublic static <E> Iterator<E> takeLast(int howMany, E[] from)
takeLast(2, [1, 2, 3]) -> [2, 3]E - the array element typehowMany - number of elements to be yieldedfrom - the source arraypublic static <E> Iterator<E> atMostLast(int howMany, Iterable<E> from)
atMostLast(4, [1, 2, 3]) -> [1, 2, 3]
atMostLast(2, [1, 2, 3]) -> [2, 3]E - the iterable element typehowMany - number of elements to be yielded (at most)from - the source iterablepublic static <E> Iterator<E> atMostLast(int howMany, Iterator<E> from)
atMostLast(4, [1, 2, 3]) -> [1, 2, 3]
atMostLast(2, [1, 2, 3]) -> [2, 3]E - the iterator element typehowMany - number of elements to be yielded (at most)from - the source iteratorpublic static <E> Iterator<E> atMostLast(int howMany, E[] from)
atMostLast(4, [1, 2, 3]) -> [1, 2, 3]
atMostLast(2, [1, 2, 3]) -> [2, 3]E - the array element typehowMany - number of elements to be yielded (at most)from - the source arraypublic static <E> Iterator<E> takeWhile(Iterator<E> iterator, Predicate<E> predicate)
takeWhile([2, 4, 3, 6], isEven) -> [2, 4]E - the iterator element typeiterator - the source iteratorpredicate - the predicate to be evaluatedpublic static <E> Iterator<E> takeWhile(Iterable<E> iterable, Predicate<E> predicate)
takeWhile([2, 4, 3, 6], isEven) -> [2, 4]E - the iterable element typeiterable - the source iterablepredicate - the predicate to be evaluatedpublic static <E> Iterator<E> takeWhile(E[] array, Predicate<E> predicate)
takeWhile([2, 4, 3, 6], isEven) -> [2, 4]E - the array element typearray - the source iterablepredicate - the predicate to be evaluatedpublic static <E> Iterator<E> dropWhile(Iterator<E> iterator, Predicate<E> predicate)
dropWhile([2, 4, 3, 6], isOdd) -> [2, 4]E - the iterator element typeiterator - the source iteratorpredicate - the predicate to be evaluatedpublic static <E> Iterator<E> dropWhile(Iterable<E> iterable, Predicate<E> predicate)
dropWhile([2, 4, 3, 6], isOdd) -> [2, 4]E - the iterable element typeiterable - the source iterablepredicate - the predicate to be evaluatedpublic static <E> Iterator<E> dropWhile(E[] array, Predicate<E> predicate)
dropWhile([2, 4, 3, 6], isOdd) -> [2, 4]E - the array element typearray - the source arraypredicate - the predicate to be evaluatedpublic static <E> Iterator<E> take(long howMany, Iterator<E> iterator)
take(2, [1, 2, 3]) -> [1, 2]
take(4, [1, 2, 3]) -> [1, 2, 3]E - the iterator element typehowMany - elements to be consumed (at most)iterator - the source iteratorpublic static <E> Iterator<E> take(long howMany, Iterable<E> iterable)
take(2, [1, 2, 3]) -> [1, 2]
take(4, [1, 2, 3]) -> [1, 2, 3]E - the iterable element typehowMany - elements to be consumed (at most)iterable - the source iterablepublic static <E> Iterator<E> take(long howMany, E... array)
take(2, [1, 2, 3]) -> [1, 2]
take(4, [1, 2, 3]) -> [1, 2, 3]E - the array element typehowMany - elements to be consumed (at most)array - the source arraypublic static <E> Iterator<E> drop(long howMany, Iterator<E> iterator)
drop(3, [1,2,3,4]) -> [4]E - the iterator element typehowMany - elements to be discardediterator - the source iteratorpublic static <E> Iterator<E> drop(long howMany, Iterable<E> iterable)
drop(3, [1,2,3,4]) -> [4]E - the iterator element typehowMany - elements to be discardediterable - the source iterablepublic static <E> Iterator<E> drop(long howMany, E... array)
drop(3, [1,2,3,4]) -> [4]E - the iterator element typehowMany - elements to be discardedarray - the source arraypublic static <E> Iterator<E> slice(long from, long howMany, Iterator<E> iterator)
slice(1, 2, ["a", "b", "c", "d"]) -> ["b", "c"]E - the iterator element typefrom - the index at which the slice startshowMany - the slice size (at most)iterator - the source iteratorpublic static <E> Iterator<E> slice(long from, long howMany, Iterable<E> iterable)
slice(1, 2, ["a", "b", "c", "d"]) -> ["b", "c"]E - the iterator element typefrom - the index at which the slice startshowMany - the slice size (at most)iterable - the source iterablepublic static <E> Iterator<E> slice(long from, long howMany, E... array)
slice(1, 2, ["a", "b", "c", "d"]) -> ["b", "c"]E - the iterator element typefrom - the index at which the slice startshowMany - the slice size (at most)array - the source arrayCopyright © 2017. All rights reserved.