Class ListUtils

java.lang.Object
org.apache.jena.atlas.lib.ListUtils

public class ListUtils extends Object
Various things for lists
  • Method Details

    • unique

      public static <T> List<T> unique(List<T> list)
    • asList

      public static List<Integer> asList(int... values)
    • last

      public static <T> T last(List<T> list)
    • toList

      public static <T> List<T> toList(Stream<T> stream)
    • str

      public static <T> String str(T[] array)
    • str

      public static String str(int[] array)
    • str

      public static String str(long[] array)
    • print

      public static <T> void print(IndentedWriter out, List<T> list)
    • print

      public static <T> void print(IndentedWriter out, List<T> list, CharSequence sep)
    • equalsUnordered

      public static <T> boolean equalsUnordered(List<T> list1, List<T> list2)
      Compare two lists, same elements, order of the lists may be different, elements must have the same cardinality.
    • listDiff

      public static <T> List<T> listDiff(List<T> list1, List<T> list2)
      Asymmetric diff of two unordered lists, returning the elements in list1 not in list2. Cardinality is significant.
    • listDiffBoth

      public static <T> Pair<List<T>,List<T>> listDiffBoth(List<T> list1, List<T> list2)
      Diff of two unordered lists, returning the elements in list1 not in list2, and the elements of list2 not in list1. Cardinality is significant.
    • permute

      public static <T> List<List<T>> permute(List<T> c)
      Return a list of lists of all the elements of collection in every order Easy to run out of heap memory. See also org.apache.jena.ext.com.google.common.collect.Collections2#permutations