Class CollectionHelper

java.lang.Object
ch.rasc.wamp2spring.util.CollectionHelper

public class CollectionHelper extends Object
Collection helper class
  • Constructor Details

    • CollectionHelper

      public CollectionHelper()
  • Method Details

    • toList

      @SafeVarargs @Nullable public static <T> List<T> toList(@Nullable T... arguments)
      Converts a vararg argument to a List.
      Parameters:
      arguments - variable number of instances
      Returns:
      a List instance with the provided arguments
    • toList

      @Nullable public static <T> List<Object> toList(@Nullable Collection<T> collection)
      Converts an arbitrary Collection to a List.

      Returns the same object if the provided parameter is already an instance of List.

      Parameters:
      collection - an arbitrary instance of Collection
      Returns:
      an instance of List containing all the elements of the provided collection
    • toSet

      @Nullable public static Set<Long> toSet(@Nullable Collection<Long> collection)
      Converts an arbitrary Collection to a Set. Removes duplicates.
      Parameters:
      collection - an arbitrary instance of Collection
      Returns:
      an instance of Set containing all the elements of the provided collection.