Class Lists


  • public abstract class Lists
    extends Object
    Utility class containing some List helper functions.
    Author:
    Piotr Szul
    • Constructor Detail

      • Lists

        public Lists()
    • Method Detail

      • normalizeEmpty

        @Nonnull
        public static <T> List<T> normalizeEmpty​(@Nonnull
                                                 List<T> list)
        Returns an empty list if the input list is empty; otherwise, returns the input list.
        Type Parameters:
        T - the type of elements in the list
        Parameters:
        list - the list to normalize
        Returns:
        an empty list if the input list is empty; otherwise, the input list
      • normalizeEmpty

        @Nonnull
        public static List<String> normalizeEmpty​(@Nonnull
                                                  Optional<List<String>> maybeList)
        Returns an empty list if the input list is not present; otherwise, returns the input list.
        Parameters:
        maybeList - the list to normalize
        Returns:
        an empty list if the input list is not present; otherwise, the input list