Class FluentIterableWrapper<E>
- java.lang.Object
-
- org.jenkinsci.plugins.github.util.FluentIterableWrapper<E>
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description FluentIterableWrapper<E>
append(Iterable<? extends E> other)
Returns a fluent iterable whose iterators traverse first the elements of this fluent iterable, followed by those ofother
.FluentIterableWrapper<E>
filter(com.google.common.base.Predicate<? super E> predicate)
Returns the elements from this fluent iterable that satisfy a predicate.<F extends E>
FluentIterableWrapper<F>filter(Class<F> clazz)
Returns the elements from this fluent iterable that are instances of the supplied type.com.google.common.base.Optional<E>
first()
Returns anOptional
containing the first element in this fluent iterable.com.google.common.base.Optional<E>
firstMatch(com.google.common.base.Predicate<? super E> predicate)
Returns anOptional
containing the first element in this fluent iterable that satisfies the given predicate, if such an element exists.static <E> FluentIterableWrapper<E>
from(Iterable<E> iterable)
Returns a fluent iterable that wrapsiterable
, oriterable
itself if it is already aFluentIterable
.Iterator<E>
iterator()
List<E>
toList()
Returns list from wrapped iterablecom.google.common.collect.ImmutableSet<E>
toSet()
Returns anImmutableSet
containing all of the elements from this fluent iterable with duplicates removed.<T> FluentIterableWrapper<T>
transform(com.google.common.base.Function<? super E,T> function)
Returns a fluent iterable that appliesfunction
to each element of this fluent iterable.<T> FluentIterableWrapper<T>
transformAndConcat(com.google.common.base.Function<? super E,? extends Iterable<? extends T>> function)
Appliesfunction
to each element of this fluent iterable and returns a fluent iterable with the concatenated combination of results.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
-
-
-
Method Detail
-
from
public static <E> FluentIterableWrapper<E> from(Iterable<E> iterable)
Returns a fluent iterable that wrapsiterable
, oriterable
itself if it is already aFluentIterable
.
-
append
@CheckReturnValue public final FluentIterableWrapper<E> append(Iterable<? extends E> other)
Returns a fluent iterable whose iterators traverse first the elements of this fluent iterable, followed by those ofother
. The iterators are not polled until necessary.The returned iterable's
Iterator
supportsremove()
when the correspondingIterator
supports it.
-
filter
@CheckReturnValue public final FluentIterableWrapper<E> filter(com.google.common.base.Predicate<? super E> predicate)
Returns the elements from this fluent iterable that satisfy a predicate. The resulting fluent iterable's iterator does not supportremove()
.
-
filter
@CheckReturnValue public final <F extends E> FluentIterableWrapper<F> filter(Class<F> clazz)
Returns the elements from this fluent iterable that are instances of the supplied type. The resulting fluent iterable's iterator does not supportremove()
.- Since:
- 1.25.0
-
transform
public final <T> FluentIterableWrapper<T> transform(com.google.common.base.Function<? super E,T> function)
Returns a fluent iterable that appliesfunction
to each element of this fluent iterable.The returned fluent iterable's iterator supports
remove()
if this iterable's iterator does. After a successfulremove()
call, this fluent iterable no longer contains the corresponding element.
-
transformAndConcat
public <T> FluentIterableWrapper<T> transformAndConcat(com.google.common.base.Function<? super E,? extends Iterable<? extends T>> function)
Appliesfunction
to each element of this fluent iterable and returns a fluent iterable with the concatenated combination of results.function
returns an Iterable of results.The returned fluent iterable's iterator supports
remove()
if this function-returned iterables' iterator does. After a successfulremove()
call, the returned fluent iterable no longer contains the corresponding element.
-
firstMatch
public final com.google.common.base.Optional<E> firstMatch(com.google.common.base.Predicate<? super E> predicate)
Returns anOptional
containing the first element in this fluent iterable that satisfies the given predicate, if such an element exists.Warning: avoid using a
predicate
that matchesnull
. Ifnull
is matched in this fluent iterable, aNullPointerException
will be thrown.
-
first
public final com.google.common.base.Optional<E> first()
Returns anOptional
containing the first element in this fluent iterable. If the iterable is empty,Optional.absent()
is returned.- Throws:
NullPointerException
- if the first element is null; if this is a possibility, useiterator().next()
orIterables.getFirst(java.lang.Iterable<? extends T>, T)
instead.
-
toSet
public final com.google.common.collect.ImmutableSet<E> toSet()
Returns anImmutableSet
containing all of the elements from this fluent iterable with duplicates removed.
-
-