Class EvictingSet<V>
java.lang.Object
de.florianmichael.rclasses.pattern.evicting.EvictingSet<V>
- Type Parameters:
V- The type of the set.
Implementation of an evicting set. This set will remove the first entry if the set is full.
-
Constructor Summary
ConstructorsConstructorDescriptionDummy constructor.EvictingSet(Set<V> set, int maxSize) Creates a new evicting set. -
Method Summary
-
Constructor Details
-
EvictingSet
public EvictingSet()Dummy constructor. -
EvictingSet
Creates a new evicting set.- Parameters:
set- The set.maxSize- The maximum size of the set.
-
-
Method Details
-
add
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
-
getMaxSize
public int getMaxSize()
-