public final class Linqy extends Object
| Modifier and Type | Method and Description |
|---|---|
static <T> boolean |
all(Iterable<T> sequence,
Predicate<? super T> predicate)
Determines whether a given predicate holds true for all
elements.
|
static <T> boolean |
any(Iterable<T> sequence,
Predicate<? super T> predicate)
Determines whether a given predicate holds true for at least
one element.
|
static <E> List<E> |
asList(Iterable<E> i)
Turns the iterable into a list.
|
static <E> Iterable<E> |
cast(Iterable i)
Turns an iterable into its type-safe cousin.
|
static int |
count(Iterable seq)
Count the number of elements in a sequence.
|
static <T> Iterable<T> |
filter(Iterable<T> sequence,
Predicate<? super T> filter)
Exclude all elements from an iterable that don't match a given
predicate.
|
static <F,T> Iterable<T> |
map(Iterable<F> from,
Mapper<? super F,T> mapper)
Create a new iterable by applying a mapper function to each
element of a given sequence.
|
static <E> Iterable<E> |
singleton(E single)
An iterable containing a single element.
|
public static <E> List<E> asList(Iterable<E> i)
E - element typei - the iterablepublic static <E> Iterable<E> cast(Iterable i)
E - target element typei - the iterablepublic static <E> Iterable<E> singleton(E single)
E - element typesingle - the element of the iterable to returnsingle once and only oncepublic static <F,T> Iterable<T> map(Iterable<F> from, Mapper<? super F,T> mapper)
F - source element typeT - target element typefrom - the iterable to transformmapper - the function to apply to each element of frompublic static <T> Iterable<T> filter(Iterable<T> sequence, Predicate<? super T> filter)
T - element typesequence - the iterable to filterfilter - the predicate to applypublic static int count(Iterable seq)
seq - the sequence to countpublic static <T> boolean any(Iterable<T> sequence, Predicate<? super T> predicate)
Returns false for an empty sequence.
T - element typesequence - the sequence to examinepredicate - the predicate to testpublic static <T> boolean all(Iterable<T> sequence, Predicate<? super T> predicate)
Returns true for an empty sequence.
T - element typesequence - the sequence to examinepredicate - the predicate to testCopyright © 2001–2025 XMLUnit. All rights reserved.