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,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)
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 boolean |
hasSize(Iterable<?> iterable,
int size)
Checks if the supplied iterable is of size size.
|
static <T> Iterable<T> |
iterable(Supplier<Iterator<T>> supplier) |
static <T> boolean |
none(Iterable<T> iterable,
com.google.common.base.Predicate<? super T> predicate)
Returns true if no elements in iterable fulfill predicate
|
static <T> T |
removeFirst(Iterable<T> iterable,
com.google.common.base.Predicate<T> predicate)
Removes first object matching the predicate
|
static <T> Pair<Iterable<T>,Iterable<T>> |
split(Iterable<T> unfiltered,
com.google.common.base.Predicate<T> predicate)
Splits iterable into a pair of two iterables, one fulfilling the predicate and one not fulfillling it.
|
static <T> Pair<Iterable<T>,Iterable<T>> |
split(List<T> unfiltered,
com.google.common.base.Predicate<T> predicate)
Deprecated.
since 5.7 use the Iterable variant
|
static <T> Stream<T> |
stream(Iterable<T> iterable) |
@Nullable public static <T,E extends Throwable> T find(Iterable<T> iterable, 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(Iterable<T> iterable, 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
public static <T> boolean none(@NotNull Iterable<T> iterable, @NotNull com.google.common.base.Predicate<? super T> predicate)
public static <T> T find(Iterable<T> iterable, com.google.common.base.Predicate<? super T> predicate, @Nullable String exceptionMessage)
Iterables.find(Iterable, com.google.common.base.Predicate)
.public static <T> Iterable<T> concat(Iterable<? extends T> iterable, T object)
public static <T> Iterable<T> concat(T object, Iterable<? extends T> iterable)
@Deprecated public static <T> Pair<Iterable<T>,Iterable<T>> split(List<T> unfiltered, com.google.common.base.Predicate<T> predicate)
unfiltered
- predicate
- public static <T> Pair<Iterable<T>,Iterable<T>> split(Iterable<T> unfiltered, com.google.common.base.Predicate<T> predicate)
unfiltered
- predicate
- @Nullable public static <T> T removeFirst(@NotNull Iterable<T> iterable, @NotNull com.google.common.base.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.Copyright © 2016 Atlassian Software Systems Pty Ltd. All rights reserved.