public final class BambooIterables extends Object
Modifier and Type | Method and Description |
---|---|
static <T> Iterable<T> |
concat(Iterable<? extends T> iterable,
T object)
Combines an iterable and an element into a single iterable.
|
static <T> Iterable<T> |
concat(T object,
Iterable<? extends T> iterable)
Combines an iterable and an element into a single iterable.
|
static <T> Iterable<T> |
filter(Iterable<T> iterable,
Predicate<? super T> predicate)
Equivalent of
Iterables.filter(Iterable, com.google.common.base.Predicate) relying on Java 8 stream API. |
static <T,E extends Throwable,F extends Throwable> |
find(Iterable<T> iterable,
DoubleThrowingPredicate<? super T,E,F> predicate,
T defaultValue)
Returns the first element in
iterable that satisfies the given predicate, or defaultValue if none
found. |
static <T> T |
find(Iterable<T> iterable,
com.google.common.base.Predicate<? super T> predicate,
String exceptionMessage)
Deprecated.
since 6.2 use
find(Iterable, Predicate, String) . |
static <T> T |
find(Iterable<T> iterable,
Predicate<? super T> predicate,
String exceptionMessage)
Utility method to customize exception message thrown by
Iterables.find(Iterable, com.google.common.base.Predicate) . |
static <T,E extends Throwable> |
find(Iterable<T> iterable,
ThrowingPredicate<? super T,E> predicate,
T defaultValue)
Returns the first element in
iterable that satisfies the given predicate, or defaultValue if none
found. |
static <T> T |
getFirst(Iterable<? extends T> iterable)
Returns the first element in
iterable or throws NoSuchElementException if iterable is empty. |
static <T> T |
getFirstOrElse(Iterable<T> iterable,
Supplier<T> supplier)
Returns the first element in
iterable or obtains a default from the given supplier . |
static boolean |
hasSize(Iterable<?> iterable,
int size)
Checks if the supplied iterable is of size size.
|
static <T> Iterable<T> |
iterable(Supplier<Iterator<T>> supplier)
Constructs an iterable for a supplier of iterators.
|
static <T> boolean |
none(Iterable<T> iterable,
com.google.common.base.Predicate<? super T> predicate)
Deprecated.
since 6.2 use
none(Iterable, Predicate) . |
static <T> boolean |
none(Iterable<T> iterable,
Predicate<? super T> predicate)
Returns true if no elements in iterable fulfill predicate.
|
static <T> boolean |
removeAll(Iterable<T> iterable,
T o)
Removes all occurrences of o from iterable.
|
static <T> T |
removeFirst(Iterable<T> iterable,
com.google.common.base.Predicate<T> predicate)
Deprecated.
since 6.2 use
removeFirst(Iterable, Predicate) ; |
static <T> T |
removeFirst(Iterable<T> iterable,
Predicate<T> predicate)
Removes first object matching the predicate.
|
static <T> Stream<T> |
stream(Iterable<T> iterable)
|
static <T,U> Iterable<U> |
transform(Iterable<T> iterable,
Function<? super T,U> function)
Equivalent of
Iterables.transform(Iterable, com.google.common.base.Function) relying on Java 8 stream API. |
@Nullable public static <T,E extends Throwable> T find(@NotNull Iterable<T> iterable, @NotNull ThrowingPredicate<? super T,E> predicate, @Nullable T defaultValue) throws E extends Throwable
iterable
that satisfies the given predicate, or defaultValue
if none
found.E extends Throwable
@Nullable public static <T,E extends Throwable,F extends Throwable> T find(@NotNull Iterable<T> iterable, @NotNull DoubleThrowingPredicate<? super T,E,F> predicate, @Nullable T defaultValue) throws E extends Throwable, F extends Throwable
iterable
that satisfies the given predicate, or defaultValue
if none
found.E extends Throwable
@Deprecated public static <T> T find(Iterable<T> iterable, com.google.common.base.Predicate<? super T> predicate, @Nullable String exceptionMessage)
find(Iterable, Predicate, String)
.public static <T> T find(Iterable<T> iterable, Predicate<? super T> predicate, @Nullable String exceptionMessage)
Iterables.find(Iterable, com.google.common.base.Predicate)
.@Deprecated public static <T> boolean none(@NotNull Iterable<T> iterable, @NotNull com.google.common.base.Predicate<? super T> predicate)
none(Iterable, Predicate)
.public static <T> boolean none(@NotNull Iterable<T> iterable, @NotNull Predicate<? super T> predicate)
public static <T> Iterable<T> concat(@NotNull Iterable<? extends T> iterable, @NotNull T object)
public static <T> Iterable<T> concat(@NotNull T object, @NotNull Iterable<? extends T> iterable)
@Nullable @Deprecated public static <T> T removeFirst(@NotNull Iterable<T> iterable, @NotNull com.google.common.base.Predicate<T> predicate)
removeFirst(Iterable, Predicate)
;@Nullable public static <T> T removeFirst(@NotNull Iterable<T> iterable, @NotNull Predicate<T> predicate)
public static boolean hasSize(@NotNull Iterable<?> iterable, int size)
@NotNull public static <T> T getFirst(@NotNull Iterable<? extends T> iterable)
iterable
or throws NoSuchElementException
if iterable is empty.@NotNull public static <T> T getFirstOrElse(@Nullable Iterable<T> iterable, @NotNull Supplier<T> supplier)
iterable
or obtains a default from the given supplier
.@NotNull public static <T> Iterable<T> iterable(@NotNull Supplier<Iterator<T>> supplier)
public static <T> boolean removeAll(@NotNull Iterable<T> iterable, @Nullable T o)
public static <T> Iterable<T> filter(@NotNull Iterable<T> iterable, @NotNull Predicate<? super T> predicate)
Iterables.filter(Iterable, com.google.common.base.Predicate)
relying on Java 8 stream API.Copyright © 2018 Atlassian Software Systems Pty Ltd. All rights reserved.