Class CollectionUtils

java.lang.Object
jdk.jpackage.internal.util.CollectionUtils

public final class CollectionUtils extends Object
This class consists exclusively of static methods that operate on or return collections.
  • Constructor Details

    • CollectionUtils

      public CollectionUtils()
  • Method Details

    • toCollection

      public static <T extends B, B, C extends Collection<T>> C toCollection(Collection<B> v)
      Casts the given collection to the requested type.
      Type Parameters:
      T - the type of elements in this output collection
      B - the type of elements in this input collection
      C - the output collection type
      Parameters:
      v - the input collection. Null is permitted.
      Returns:
      the input collection cast to the requested type
    • toCollectionUBW

      public static <T extends B, B, C extends Collection<T>> C toCollectionUBW(Collection<? extends B> v)
      Casts the given collection to the requested upper bounded wildcard (UBW) type.
      Type Parameters:
      T - the type of elements in this output collection
      B - the upper bound type of elements in this input collection
      C - the output collection type
      Parameters:
      v - the input collection. Null is permitted.
      Returns:
      the input collection cast to the requested type
    • toSet

      public static <T> Set<T> toSet(Collection<T> col)
      Converts the given collection to Set.
      Type Parameters:
      T - the type of elements in this output collection
      Parameters:
      col - the input collection. Null is permitted.
      Returns:
      the input collection if it is of type Set or a new Set instance created from the input collection