Class EvictingList<V>

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

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

    • EvictingList

      public EvictingList()
      Dummy constructor.
    • EvictingList

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

    • add

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

      public boolean isFull()
      Returns:
      True if the list is full.
    • getNormalList

      public List<V> getNormalList()
    • getMaxSize

      public int getMaxSize()