Class CollectionUtils


  • public final class CollectionUtils
    extends java.lang.Object
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static <T> java.util.List<T> copyList​(java.util.List<? extends T> list)
      Attempts to use native Object.clone() methods on available map types.
      static <K,​V>
      java.util.Map<K,​V>
      copyMap​(java.util.Map<? extends K,​? extends V> map)
      Attempts to use native Object.clone() methods on available map types.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • copyMap

        public static <K,​V> java.util.Map<K,​V> copyMap​(java.util.Map<? extends K,​? extends V> map)
        Attempts to use native Object.clone() methods on available map types. If a map cannot be properly cloned, a new HashMap is returned.
        Type Parameters:
        K - The key type
        V - The value type
        Parameters:
        map - The map input
        Returns:
        A copied map
      • copyList

        public static <T> java.util.List<T> copyList​(java.util.List<? extends T> list)
        Attempts to use native Object.clone() methods on available map types. If a list cannot be properly cloned, a new ArrayList is returned.
        Type Parameters:
        T - The value type
        Parameters:
        list - The list input
        Returns:
        A copied list