Class ListUtils


  • public class ListUtils
    extends java.lang.Object
    Various things for lists
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.util.List<java.lang.Integer> asList​(int... values)  
      static <T> boolean equalsUnordered​(java.util.List<T> list1, java.util.List<T> list2)
      Compare two lists, same elements, order of the lists may be different, elements must have the same cardinality.
      static <T> T last​(java.util.List<T> list)  
      static <T> java.util.List<T> listDiff​(java.util.List<T> list1, java.util.List<T> list2)
      Asymmetric diff of two unordered lists, returning the elements in list1 not in list2.
      static <T> Pair<java.util.List<T>,​java.util.List<T>> listDiffBoth​(java.util.List<T> list1, java.util.List<T> list2)
      Diff of two unordered lists, returning the elements in list1 not in list2, and the elements of list2 not in list1.
      static <T> java.util.List<java.util.List<T>> permute​(java.util.List<T> c)
      Return a list of lists of all the elements of collection in every order Easy to run out of heap memory.
      static <T> void print​(IndentedWriter out, java.util.List<T> list)  
      static <T> void print​(IndentedWriter out, java.util.List<T> list, java.lang.CharSequence sep)  
      static java.lang.String str​(int[] array)  
      static java.lang.String str​(long[] array)  
      static <T> java.lang.String str​(T[] array)  
      static <T> java.util.List<T> toList​(java.util.stream.Stream<T> stream)  
      static <T> java.util.List<T> unique​(java.util.List<T> list)  
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • unique

        public static <T> java.util.List<T> unique​(java.util.List<T> list)
      • asList

        public static java.util.List<java.lang.Integer> asList​(int... values)
      • last

        public static <T> T last​(java.util.List<T> list)
      • toList

        public static <T> java.util.List<T> toList​(java.util.stream.Stream<T> stream)
      • str

        public static <T> java.lang.String str​(T[] array)
      • str

        public static java.lang.String str​(int[] array)
      • str

        public static java.lang.String str​(long[] array)
      • print

        public static <T> void print​(IndentedWriter out,
                                     java.util.List<T> list)
      • print

        public static <T> void print​(IndentedWriter out,
                                     java.util.List<T> list,
                                     java.lang.CharSequence sep)
      • equalsUnordered

        public static <T> boolean equalsUnordered​(java.util.List<T> list1,
                                                  java.util.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> java.util.List<T> listDiff​(java.util.List<T> list1,
                                                     java.util.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<java.util.List<T>,​java.util.List<T>> listDiffBoth​(java.util.List<T> list1,
                                                                                       java.util.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> java.util.List<java.util.List<T>> permute​(java.util.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