Class GridCollections


  • public final class GridCollections
    extends Object
    Provides locked wrappers around given maps and collections. Since ReentrantLock performs a lot better than standard Java synchronization, these locked wrappers should perform better as their analogous methods in java.util.Collections class.
    • Method Detail

      • lockedMap

        public static <K,​V> Map<K,​V> lockedMap​(Map<K,​V> m)
        Gets locked map wrapping given map.
        Parameters:
        m - Map to wrap into locked implementation.
        Returns:
        Locked map.
      • lockedSet

        public static <E> Set<E> lockedSet​(Set<E> s)
        Gets locked set wrapping given set.
        Parameters:
        s - Set to wrap into locked implementation.
        Returns:
        Locked set.
      • lockedCollection

        public static <E> Collection<E> lockedCollection​(Collection<E> c)
        Gets locked collection wrapping given set.
        Parameters:
        c - Collection to wrap into locked implementation.
        Returns:
        Locked collection.