Class CollectionTools

java.lang.Object
rife.bld.extension.tools.CollectionTools

public final class CollectionTools extends Object
Collection Tools.

All public methods accept null varargs arrays or null collection references and return an empty list in those cases. Individual null elements within collections or varargs are silently ignored.

The internal methods combineAndMap and combineAndMapVarargs are implementation details and not part of the public API.

Since:
1.0
Author:
Erik C. Thauvin
  • Method Details

    • combine

      @SafeVarargs public static <T> List<T> combine(@Nullable Collection<T>... collections)
      Combines multiple collections into a single list, ignoring any null collections or null elements.

      Returns an empty list if the input array is null.

      Since:
      1.0
    • combine

      @SafeVarargs public static <T> List<T> combine(@Nullable T... elements)
      Combines varargs elements into a single list, ignoring any null elements.

      Returns an empty list if the input array is null.

      Since:
      1.0
    • combineFilesToPaths

      @SafeVarargs public static List<Path> combineFilesToPaths(@Nullable Collection<File>... collections)
      Combines multiple File collections into a list of Path objects.

      Null collections and null elements are ignored.

      Since:
      1.0
    • combineFilesToPaths

      public static List<Path> combineFilesToPaths(@Nullable File... files)
      Combines varargs File elements into a list of Path objects.

      Null elements are ignored.

      Since:
      1.0
    • combineFilesToStrings

      @SafeVarargs public static List<String> combineFilesToStrings(@Nullable Collection<File>... collections)
      Combines multiple File collections into a list of normalized absolute path strings.

      Uses Path.toAbsolutePath() and Path.normalize().

      Since:
      1.0
    • combineFilesToStrings

      public static List<String> combineFilesToStrings(@Nullable File... files)
      Combines varargs File elements into a list of normalized absolute path strings.

      Uses Path.toAbsolutePath() and Path.normalize().

      Since:
      1.0
    • combinePathsToFiles

      @SafeVarargs public static List<File> combinePathsToFiles(@Nullable Collection<Path>... collections)
      Combines multiple Path collections into a list of File objects.

      Null collections and null elements are ignored.

      Since:
      1.0
    • combinePathsToFiles

      public static List<File> combinePathsToFiles(@Nullable Path... paths)
      Combines varargs Path elements into a list of File objects.

      Null elements are ignored.

      Since:
      1.0
    • combinePathsToStrings

      @SafeVarargs public static List<String> combinePathsToStrings(@Nullable Collection<Path>... collections)
      Combines multiple Path collections into a list of absolute path strings.

      Null collections and null elements are ignored.

      Since:
      1.0
    • combinePathsToStrings

      public static List<String> combinePathsToStrings(@Nullable Path... paths)
      Combines varargs Path elements into a list of absolute path strings.

      Null elements are ignored.

      Since:
      1.0
    • combineStringsToFiles

      @SafeVarargs public static List<File> combineStringsToFiles(@Nullable Collection<String>... collections)
      Combines multiple string collections into a list of File objects.

      Null collections and null elements are ignored.

      Since:
      1.0
    • combineStringsToFiles

      public static List<File> combineStringsToFiles(@Nullable String... strings)
      Combines varargs string elements into a list of File objects.

      Null elements are ignored.

      Since:
      1.0
    • combineStringsToPaths

      @SafeVarargs public static List<Path> combineStringsToPaths(@Nullable Collection<String>... collections)
      Combines multiple string collections into a list of Path objects.

      Null collections and null elements are ignored.

      Since:
      1.0
    • combineStringsToPaths

      public static List<Path> combineStringsToPaths(@Nullable String... strings)
      Combines varargs string elements into a list of Path objects.

      Null elements are ignored.

      Since:
      1.0