Package edu.jas.util

Class ListUtil

java.lang.Object
edu.jas.util.ListUtil

public class ListUtil extends Object
List utilities. For example map functor on list elements.
  • Constructor Details

    • ListUtil

      public ListUtil()
  • Method Details

    • map

      public static <C extends Element<C>, D extends Element<D>> List<D> map(List<C> list, UnaryFunctor<C,D> f)
      Map a unary function to the list.
      Parameters:
      f - evaluation functor.
      Returns:
      new list elements f(list(i)).
    • tupleFromList

      public static <C> List<List<C>> tupleFromList(List<List<C>> A)
      Tuple from lists.
      Parameters:
      A - list of lists.
      Returns:
      new list with tuples (a_1,...,an) with ai in Ai, i=0,...,length(A)-1.
    • fill

      public static <C> List<C> fill(int n, C e)
      Create a list of given length and content.
      Parameters:
      n - length of new list
      e - object to be filled in
      Returns:
      list (e, ..., e) of length n
    • equals

      public static <C> boolean equals(Iterable<C> a, Iterable<C> b)
      Test two iterables for equal contents and sequence.
      Parameters:
      a - iterable
      b - iterable
      Returns:
      true, if a equals b in sequence and content, else false.