Class ListUtils


  • public final class ListUtils
    extends Object
    Since:
    1.0
    Author:
    Daniel Fernández
    • Method Detail

      • toList

        public static List<?> toList​(Object target)
      • size

        public static int size​(List<?> target)
      • isEmpty

        public static boolean isEmpty​(List<?> target)
      • contains

        public static boolean contains​(List<?> target,
                                       Object element)
      • containsAll

        public static boolean containsAll​(List<?> target,
                                          Object[] elements)
      • containsAll

        public static boolean containsAll​(List<?> target,
                                          Collection<?> elements)
      • sort

        public static <T extends Comparable<? super T>> List<T> sort​(List<T> list)

        Creates an new instance of the list add the sorted list to it.

        Type Parameters:
        T - the type of the list elements.
        Parameters:
        list - the list which content should be ordered.
        Returns:
        a new sorted list.
        See Also:
        Collections.sort(List)
      • sort

        public static <T> List<T> sort​(List<T> list,
                                       Comparator<? super T> c)

        Creates an new instance of the list add the sorted list to it.

        Type Parameters:
        T - the type of the list elements.
        Parameters:
        list - the list which content should be ordered.
        c - the comparator.
        Returns:
        a new sorted list.
        See Also:
        Collections.sort(List, Comparator)