com.hazelcast.cache

## Class CacheEvictionPolicyComparator<K,V>

- java.lang.Object
- - com.hazelcast.internal.eviction.EvictionPolicyComparator<K,V,CacheEntryView<K,V>>
  - - com.hazelcast.cache.CacheEvictionPolicyComparator<K,V>

- Type Parameters:
    `K` - type of the key
    `V` - type of the value
  All Implemented Interfaces:
    Serializable, Comparator<CacheEntryView<K,V>>

      public abstract class CacheEvictionPolicyComparator<K,V>
      extends com.hazelcast.internal.eviction.EvictionPolicyComparator<K,V,CacheEntryView<K,V>>

  Cache specific `EvictionPolicyComparator` for comparing `CacheEntryView`s to be evicted.
  See Also:
    `EvictionPolicyComparator`, `CacheEntryView`, Serialized Form

- - ### Field Summary

    - ### Fields inherited from class com.hazelcast.internal.eviction.EvictionPolicyComparator

      `BOTH_OF_ENTRIES_HAVE_SAME_PRIORITY_TO_BE_EVICTED, FIRST_ENTRY_HAS_HIGHER_PRIORITY_TO_BE_EVICTED, SECOND_ENTRY_HAS_HIGHER_PRIORITY_TO_BE_EVICTED`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `CacheEvictionPolicyComparator()`

  - ### Method Summary

    All Methods Instance Methods Abstract Methods
    Modifier and Type | Method and Description
    --- | ---
    `abstract int` | `compare(CacheEntryView<K,V> e1, CacheEntryView<K,V> e2)` Compares the given `EvictableEntryView` instances and returns the result.

    - ### Methods inherited from class com.hazelcast.internal.eviction.EvictionPolicyComparator

      `equals, hashCode`

    - ### Methods inherited from class java.lang.Object

      `clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait`

    - ### Methods inherited from interface java.util.Comparator

      `comparing, comparing, comparingDouble, comparingInt, comparingLong, naturalOrder, nullsFirst, nullsLast, reversed, reverseOrder, thenComparing, thenComparing, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLong`

- - ### Constructor Detail

    - #### CacheEvictionPolicyComparator

          public CacheEvictionPolicyComparator()

  - ### Method Detail

    - #### compare

          public abstract int compare(CacheEntryView<K,V> e1,
                                      CacheEntryView<K,V> e2)

      Compares the given `EvictableEntryView` instances and returns the result. The result should be one of the
      - #FIRST_ENTRY_HAS_HIGHER_PRIORITY_TO_BE_EVICTED
      - #SECOND_ENTRY_HAS_HIGHER_PRIORITY_TO_BE_EVICTED
      - #BOTH_OF_ENTRIES_HAVE_SAME_PRIORITY_TO_BE_EVICTED
      Specified by:
        `compare` in interface `Comparator<CacheEntryView<K,V>>`
      Specified by:
        `compare` in class `com.hazelcast.internal.eviction.EvictionPolicyComparator<K,V,CacheEntryView<K,V>>`
      Parameters:
        `e1` - the first `EvictableEntryView` instance to be compared
        `e2` - the second `EvictableEntryView` instance to be compared
      Returns:
        the result of comparison

Copyright © 2019. All rights reserved.