Class CollectionUtils


  • public class CollectionUtils
    extends java.lang.Object
    Utility methods related to Java Collections.
    • Method Detail

      • createLRUCache

        @Deprecated
        public static <K,​V> java.util.Map<K,​V> createLRUCache​(int size)
        Deprecated.
        use org.plumelib.util.CollectionsPlume.createLruCache
        Creates a LRU cache.
        Parameters:
        size - size of the cache
        Returns:
        a new cache with the provided size
      • cloneElements

        @Deprecated
        public static <T extends @Nullable java.lang.Object,​C extends @Nullable java.util.Collection<T>> @PolyNull C cloneElements​(@PolyNull C orig)
        Deprecated.
        use org.plumelib.util.CollectionsPlume.cloneElements
        Returns a copy of orig, where each element of the result is a clone of the corresponding element of orig.
        Type Parameters:
        T - the type of elements of the collection
        C - the type of the collection
        Parameters:
        orig - a collection
        Returns:
        a copy of orig, as described above
      • cloneElements

        @Deprecated
        public static <K,​V,​M extends @Nullable java.util.Map<K,​V>> @PolyNull M cloneElements​(@PolyNull M orig)
        Deprecated.
        use org.plumelib.util.CollectionsPlume.cloneElements
        Returns a copy of orig, where each key and value in the result is a clone of the corresponding element of orig.
        Type Parameters:
        K - the type of keys of the map
        V - the type of values of the map
        M - the type of the map
        Parameters:
        orig - a map
        Returns:
        a copy of orig, as described above
      • cloneValues

        @Deprecated
        public static <K,​V,​M extends @Nullable java.util.Map<K,​V>> @PolyNull M cloneValues​(@PolyNull M orig)
        Deprecated.
        use org.plumelib.util.CollectionsPlume.cloneValues
        Returns a copy of orig, where each value of the result is a clone of the corresponding value of orig, but the keys are the same objects.
        Type Parameters:
        K - the type of keys of the map
        V - the type of values of the map
        M - the type of the map
        Parameters:
        orig - a map
        Returns:
        a copy of orig, as described above
      • deepCopy

        @Deprecated
        public static <T extends @Nullable org.plumelib.util.DeepCopyable<T>,​C extends @Nullable java.util.Collection<T>> @PolyNull C deepCopy​(@PolyNull C orig)
        Deprecated.
        use org.plumelib.util.CollectionsPlume.deepCopy
        Returns a copy of orig, where each element of the result is a deep copy (according to the DeepCopyable interface) of the corresponding element of orig.
        Type Parameters:
        T - the type of elements of the collection
        C - the type of the collection
        Parameters:
        orig - a collection
        Returns:
        a copy of orig, as described above
      • deepCopy

        @Deprecated
        public static <K extends @Nullable org.plumelib.util.DeepCopyable<K>,​V extends @Nullable org.plumelib.util.DeepCopyable<V>,​M extends @Nullable java.util.Map<K,​V>> @PolyNull M deepCopy​(@PolyNull M orig)
        Deprecated.
        use org.plumelib.util.CollectionsPlume.deepCopy
        Returns a copy of orig, where each key and value in the result is a deep copy (according to the DeepCopyable interface) of the corresponding element of orig.
        Type Parameters:
        K - the type of keys of the map
        V - the type of values of the map
        M - the type of the map
        Parameters:
        orig - a map
        Returns:
        a copy of orig, as described above
      • deepCopyValues

        @Deprecated
        public static <K,​V extends @Nullable org.plumelib.util.DeepCopyable<V>,​M extends @Nullable java.util.Map<K,​V>> @PolyNull M deepCopyValues​(@PolyNull M orig)
        Deprecated.
        use org.plumelib.util.CollectionsPlume.deepCopyValues
        Returns a copy of orig, where each value of the result is a deep copy (according to the DeepCopyable interface) of the corresponding value of orig, but the keys are the same objects.
        Type Parameters:
        K - the type of keys of the map
        V - the type of values of the map
        M - the type of the map
        Parameters:
        orig - a map
        Returns:
        a copy of orig, as described above