Class CounterStorageKeyComparator

  • All Implemented Interfaces:
    Comparator<String>

    public class CounterStorageKeyComparator
    extends Object
    implements Comparator<String>
    A Comparator used to order storage keys so that the least used and oldest storage keys are returned first. The constructor for this class accepts two arguments : (1) the storage keys in order of oldest first and (2) the number of times the storage keys were used.
    • Field Detail

      • log

        @Nonnull
        private final Logger log
        Class logger.
      • storageKeys

        @Nonnull
        private final List<String> storageKeys
        Storage keys in FIFO order.
      • keyToCounterMap

        @Nonnull
        private final Map<String,​Long> keyToCounterMap
        Map of storage keys to counters.
    • Constructor Detail

      • CounterStorageKeyComparator

        public CounterStorageKeyComparator​(@Nonnull
                                           List<String> keys,
                                           @Nonnull
                                           Map<String,​Long> map)
        Constructor.
        Parameters:
        keys - storage keys in FIFO order
        map - number of times the storage keys were used