@ReadOnly public interface FunctionalIterable<ELEMENT> extends Iterable<ELEMENT>
Iterable interface with functional methods.InfiniteIterable,
FiniteIterable| Modifier and Type | Method and Description |
|---|---|
default @Nonnull FiniteIterable<ELEMENT> |
extract(@Positive int startIndex,
@Positive int endIndex)
Returns the elements of this iterable from the given start index to but not including the given end index.
|
@Nonnull FunctionalIterable<ELEMENT> |
filter(@Nonnull FailablePredicate<? super ELEMENT,?> predicate)
Returns the elements of this iterable that satisfy the given predicate.
|
@Nonnull FunctionalIterable<ELEMENT> |
filterNot(@Nonnull FailablePredicate<? super ELEMENT,?> predicate)
Returns the elements of this iterable that do not satisfy the given predicate.
|
@Nonnull FunctionalIterable<ELEMENT> |
filterNulls()
Returns the elements of this iterable without the null values.
|
<TYPE> @Nonnull FunctionalIterable<TYPE> |
flatten(@Positive int level)
Returns the elements of this iterable with all collections up to the given level flattened.
|
<TYPE> @Nonnull FunctionalIterable<TYPE> |
flattenAll()
Returns the elements of this iterable with all collections directly or indirectly contained in this iterable flattened.
|
<TYPE> @Nonnull FunctionalIterable<TYPE> |
flattenOne()
Returns the elements of this iterable with all collections directly contained in this iterable flattened.
|
default ELEMENT |
get(int index)
Returns the element at the given index.
|
default boolean |
hasSize(@NonNegative int number)
Returns whether this iterable has the given number of elements.
|
<TYPE> @Nonnull FunctionalIterable<TYPE> |
instanceOf(@Nonnull Class<TYPE> type)
Returns the elements of this iterable which are an instance of the given type.
|
default boolean |
isEmpty()
Returns whether this iterable is empty.
|
default boolean |
isEmptyOrSingle()
Returns whether this iterable is empty or single.
|
default boolean |
isSingle()
Returns whether this iterable contains a single element.
|
@Nonnull ReadOnlyIterator<ELEMENT> |
iterator() |
default @Nonnull FiniteIterable<ELEMENT> |
limit(@Positive int number)
Returns the given number of elements from the beginning of this iterable.
|
<TYPE> @Nonnull FunctionalIterable<TYPE> |
map(@Nonnull FailableUnaryFunction<? super ELEMENT,? extends TYPE,?> function)
Returns the elements of this iterable mapped by the given function.
|
default @NonNegative int |
size(@Positive int limit)
Returns the size of this iterable or the given limit if the size is greater than the limit.
|
default boolean |
sizeAtLeast(@Positive int value)
Returns whether the size of this iterable is at least the given value.
|
default boolean |
sizeAtMost(@NonNegative int value)
Returns whether the size of this iterable is at most the given value.
|
@Nonnull FunctionalIterable<ELEMENT> |
skip(@Positive int number)
Returns the elements of this iterable after discarding the given number of elements from the beginning.
|
<TYPE> @Nonnull FunctionalIterable<Pair<ELEMENT,TYPE>> |
zipLongest(@Nonnull FiniteIterable<? extends TYPE> iterable)
Returns the elements from this and the given iterable as pairs, where the i-th pair contains the i-th element of each iterable.
|
default <TYPE> @Nonnull InfiniteIterable<Pair<ELEMENT,TYPE>> |
zipLongest(@Nonnull InfiniteIterable<? extends TYPE> iterable)
Returns the elements from this and the given iterable as pairs, where the i-th pair contains the i-th element of each iterable.
|
default <TYPE> @Nonnull FiniteIterable<Pair<ELEMENT,TYPE>> |
zipShortest(@Nonnull FiniteIterable<? extends TYPE> iterable)
Returns the elements from this and the given iterable as pairs, where the i-th pair contains the i-th element of each iterable.
|
<TYPE> @Nonnull FunctionalIterable<Pair<ELEMENT,TYPE>> |
zipShortest(@Nonnull InfiniteIterable<? extends TYPE> iterable)
Returns the elements from this and the given iterable as pairs, where the i-th pair contains the i-th element of each iterable.
|
forEach, spliterator@Pure @Capturable @Nonnull @Nonnull ReadOnlyIterator<ELEMENT> iterator()
@Pure default boolean isEmpty()
@Pure
@NonNegative
default @NonNegative int size(@Positive
@Positive int limit)
IndexOutOfBoundsException - if the given limit is non-positive.@Pure
default boolean hasSize(@NonNegative
@NonNegative int number)
@Pure default boolean isSingle()
@Pure default boolean isEmptyOrSingle()
@Pure
default boolean sizeAtMost(@NonNegative
@NonNegative int value)
@Pure
default boolean sizeAtLeast(@Positive
@Positive int value)
@Pure @NonCapturable default ELEMENT get(int index)
IndexOutOfBoundsException - if the given index is negative or greater or equal to the size of this iterable.@Pure @Nonnull @Nonnull FunctionalIterable<ELEMENT> filter(@Nonnull @Nonnull FailablePredicate<? super ELEMENT,?> predicate)
IterationException.@Pure @Nonnull @Nonnull FunctionalIterable<ELEMENT> filterNot(@Nonnull @Nonnull FailablePredicate<? super ELEMENT,?> predicate)
IterationException.@Pure @Nonnull @Nonnull FunctionalIterable<ELEMENT> filterNulls()
@Pure @Nonnull <TYPE> @Nonnull FunctionalIterable<TYPE> map(@Nonnull @Nonnull FailableUnaryFunction<? super ELEMENT,? extends TYPE,?> function)
IterationException.@Pure @Nonnull <TYPE> @Nonnull FunctionalIterable<TYPE> instanceOf(@Nonnull @Nonnull Class<TYPE> type)
@Pure @Nonnull @Nonnull FunctionalIterable<ELEMENT> skip(@Positive @Positive int number)
@Pure @Nonnull default @Nonnull FiniteIterable<ELEMENT> limit(@Positive @Positive int number)
@Pure @Nonnull default @Nonnull FiniteIterable<ELEMENT> extract(@Positive @Positive int startIndex, @Positive @Positive int endIndex)
Integer.MAX_VALUE, the returned iterable iterates as long as this iterable does,
which means calling extract(startIndex, Integer.MAX_VALUE) is the same as skip(startIndex).@Pure @Nonnull default <TYPE> @Nonnull FiniteIterable<Pair<ELEMENT,TYPE>> zipShortest(@Nonnull @Nonnull FiniteIterable<? extends TYPE> iterable)
@Pure @Nonnull <TYPE> @Nonnull FunctionalIterable<Pair<ELEMENT,TYPE>> zipShortest(@Nonnull @Nonnull InfiniteIterable<? extends TYPE> iterable)
@Pure @Nonnull <TYPE> @Nonnull FunctionalIterable<Pair<ELEMENT,TYPE>> zipLongest(@Nonnull @Nonnull FiniteIterable<? extends TYPE> iterable)
@Pure @Nonnull default <TYPE> @Nonnull InfiniteIterable<Pair<ELEMENT,TYPE>> zipLongest(@Nonnull @Nonnull InfiniteIterable<? extends TYPE> iterable)
@Pure @Nonnull <TYPE> @Nonnull FunctionalIterable<TYPE> flatten(@Positive @Positive int level)
@Pure @Nonnull <TYPE> @Nonnull FunctionalIterable<TYPE> flattenOne()
@Pure @Nonnull <TYPE> @Nonnull FunctionalIterable<TYPE> flattenAll()
Copyright © 2017. All rights reserved.