Class CollectionUtils

java.lang.Object
com.gigaspaces.internal.utils.CollectionUtils

public abstract class CollectionUtils extends Object
Miscellaneous collection utility methods. Mainly for internal use within the framework.
Author:
kimchy
  • Constructor Details

    • CollectionUtils

      public CollectionUtils()
  • Method Details

    • isEmpty

      public static boolean isEmpty(Collection<?> collection)
      Return true if the supplied Collection is null or empty. Otherwise, return false.
      Parameters:
      collection - the Collection to check
    • toStream

      public static <T> java.util.stream.Stream<T> toStream(Collection<T> collection)
    • toList

      public static <T> List<T> toList(T... items)
      Converts the supplied array into a List.
      Parameters:
      source - the original array
      Returns:
      the converted List result
    • toUnmodifiableList

      public static <T> List<T> toUnmodifiableList(T... items)
    • toSet

      public static <T> Set<T> toSet(T... items)
      Converts the supplied array into a Set.
      Parameters:
      source - the original array
      Returns:
      the converted List result
    • toUnmodifiableSet

      public static <T> Set<T> toUnmodifiableSet(T... items)
    • equals

      public static <T> boolean equals(Collection<T> c1, Collection<T> c2)
    • cloneList

      public static <T> List<T> cloneList(List<T> list)
    • cloneCollection

      public static <T> Collection<T> cloneCollection(Collection<T> collection)
    • cloneMap

      public static <K, V> Map<K,V> cloneMap(Map<K,V> map)
    • first

      public static <T> T first(Collection<T> collection)