Class EvictingCollection<V>
java.lang.Object
de.florianmichael.rclasses.pattern.evicting.EvictingCollection<V>
- Type Parameters:
V- The type of the collection.
Implementation of an evicting collection. This collection will remove the first entry if the collection is full.
-
Constructor Summary
ConstructorsConstructorDescriptionDummy constructor.EvictingCollection(Collection<V> collection, int maxSize) Creates a new evicting collection. -
Method Summary
-
Constructor Details
-
EvictingCollection
public EvictingCollection()Dummy constructor. -
EvictingCollection
Creates a new evicting collection.- Parameters:
collection- The collection.maxSize- The maximum size of the collection.
-
-
Method Details
-
add
Adds a value to the collection. If the collection is full, the first entry will be removed. Returns true if the collection was full.- Parameters:
value- The value to add.- Returns:
- True if the collection was full.
-
isFull
public boolean isFull()- Returns:
- True if the collection is full.
-
getNormalCollection
-
getMaxSize
public int getMaxSize()
-