Class Linqy

java.lang.Object
org.xmlunit.util.Linqy

public final class Linqy extends Object
A couple of (functional) sequence processing constructs.
  • Constructor Details

    • Linqy

      private Linqy()
  • Method Details

    • asList

      public static <E> List<E> asList(Iterable<E> i)
      Turns the iterable into a list.
    • cast

      public static <E> Iterable<E> cast(Iterable i)
      Turns an iterable into its type-safe cousin.
    • singleton

      public static <E> Iterable<E> singleton(E single)
      An iterable containing a single element.
    • map

      public 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.
    • filter

      public 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.
    • count

      public static int count(Iterable seq)
      Count the number of elements in a sequence.
    • any

      public static <T> boolean any(Iterable<T> sequence, Predicate<? super T> predicate)
      Determines whether a given predicate holds true for at least one element.

      Returns false for an empty sequence.

    • all

      public static <T> boolean all(Iterable<T> sequence, Predicate<? super T> predicate)
      Determines whether a given predicate holds true for all elements.

      Returns true for an empty sequence.