Class ListBuilders


  • public final class ListBuilders
    extends java.lang.Object
    Helper functions for building lists with examples.
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static <T> java.util.List<T> buildListOfAtLeastOne​(T first, T... more)
      Builds a list with at least one example.
      static <T> java.util.List<T> buildListOfAtLeastTwo​(T first, T second, T... more)
      Builds a list with at least two examples.
      static <T> boolean listContainsDuplicates​(java.util.List<T> list)
      Determines whether a list contains the same example more than once.
      • Methods inherited from class java.lang.Object

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

      • buildListOfAtLeastOne

        @SafeVarargs
        public static <T> java.util.List<T> buildListOfAtLeastOne​(T first,
                                                                  T... more)
        Builds a list with at least one example.
        Type Parameters:
        T - The type of example.
        Parameters:
        first - The first example.
        more - Zero or more additional examples.
        Returns:
        A list with at least one example.
      • buildListOfAtLeastTwo

        @SafeVarargs
        public static <T> java.util.List<T> buildListOfAtLeastTwo​(T first,
                                                                  T second,
                                                                  T... more)
        Builds a list with at least two examples.
        Type Parameters:
        T - The type of example.
        Parameters:
        first - The first example.
        second - The second example.
        more - Zero or more additional examples.
        Returns:
        A list with at least two examples.
      • listContainsDuplicates

        public static <T> boolean listContainsDuplicates​(java.util.List<T> list)
        Determines whether a list contains the same example more than once.
        Type Parameters:
        T - The type of example.
        Parameters:
        list - The list that may or may not contain duplicates.
        Returns:
        Whether the given list contains duplicates.