Class Soft


  • public final class Soft
    extends Object
    Utility methods for dealing with SoftReference collections.
    • Method Detail

      • elements

        public static <T> Collection<T> elements​(int capacity)
        Parameters:
        capacity - The initial capacity
        Returns:
        Collection whose elements are kept alive with SoftReferences
      • keys

        public static <K,​V> Map<K,​V> keys()
        Returns:
        Map whose keys are kept alive with SoftReferences
      • keys

        public static <K,​V> Map<K,​V> keys​(int capacity)
        Parameters:
        capacity - The initial capacity
        Returns:
        Map whose keys are kept alive with SoftReferences
      • concurrentKeys

        public static <K,​V> ConcurrentMap<K,​V> concurrentKeys​(int capacity,
                                                                          int concurrency)
        Parameters:
        capacity - The initial capacity
        concurrency - The concurrency level
        Returns:
        ConcurrentMap whose keys are kept alive with SoftReferences
      • values

        public static <K,​V> Map<K,​V> values()
        Returns:
        Map whose values are kept alive with SoftReferences
      • values

        public static <K,​V> Map<K,​V> values​(int capacity)
        Parameters:
        capacity - The initial capacity
        Returns:
        Map whose values are kept alive with SoftReferences
      • concurrentValues

        public static <K,​V> ConcurrentMap<K,​V> concurrentValues​(int capacity,
                                                                            int concurrency)
        Parameters:
        capacity - The initial capacity
        concurrency - The concurrency level
        Returns:
        ConcurrentMap whose values are kept alive with SoftReferences