Class EvictingSet<V>

java.lang.Object
de.florianmichael.rclasses.pattern.evicting.EvictingSet<V>
Type Parameters:
V - The type of the set.

public final class EvictingSet<V> extends Object
Implementation of an evicting set. This set will remove the first entry if the set is full.
  • Constructor Details

    • EvictingSet

      public EvictingSet()
      Dummy constructor.
    • EvictingSet

      public EvictingSet(Set<V> set, int maxSize)
      Creates a new evicting set.
      Parameters:
      set - The set.
      maxSize - The maximum size of the set.
  • Method Details

    • add

      public boolean add(V value)
      Adds a value to the set. If the set is full, the first entry will be removed. Returns true if the set was full.
      Parameters:
      value - The value to add.
      Returns:
      True if the set was full.
    • isFull

      public boolean isFull()
      Returns:
      True if the set is full.
    • getNormalSet

      public Set<V> getNormalSet()
    • getMaxSize

      public int getMaxSize()