Package org.aksw.commons.collections
Class CacheSet<K>
java.lang.Object
org.aksw.commons.collections.CacheSet<K>
- Type Parameters:
K-
- All Implemented Interfaces:
Iterable<K>,Collection<K>,Set<K>
T is the Timestamp object (e.g. Date, Long, etc). Multiple keys may have the
same timestamp.
At each time there may only be a single key.
- Author:
- raven JFreeChart
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanPut operations are done for the current timebooleanbooleanaddAll(Collection<? extends K> arg0) addAndGetRemoved(K key) Adds an item, and returns an item that was removed - or null if no item was removedvoidclear()booleanbooleancontainsAll(Collection<?> arg0) booleangetKeyTime(K key) inthashCode()booleanisEmpty()iterator()FIXME Make sure that the iterator's remove method cannot be invoked directlybooleanbooleanremoveAll(Collection<?> items) booleanbooleanretainAll(Collection<?> arg0) setMaxItemCount(int newMaxItemCount) Sets a new maximum distance.intsize()Object[]toArray()<X> X[]toArray(X[] arg0) toString()Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface java.util.Collection
parallelStream, removeIf, stream, toArrayMethods inherited from interface java.util.Set
spliterator
-
Constructor Details
-
CacheSet
public CacheSet()inclusive: wheter max distance is inclusive or exclusive. e.g. if maxDistance is 10, and a distance is also 10, then inclusive: the item is retained (10 is included) exclusive: the item is removed -
CacheSet
public CacheSet(int maxItemCount, boolean allowRenewal)
-
-
Method Details
-
getKeyTime
-
setMaxItemCount
Sets a new maximum distance. Returns all items that become outdated- Parameters:
newMaxItemCount-
-
renew
-
addAndGetRemoved
Adds an item, and returns an item that was removed - or null if no item was removed- Parameters:
key-- Returns:
-
add
-
_add
Put operations are done for the current time -
addAll
-
clear
public void clear() -
contains
-
containsAll
- Specified by:
containsAllin interfaceCollection<K>- Specified by:
containsAllin interfaceSet<K>
-
isEmpty
public boolean isEmpty() -
iterator
FIXME Make sure that the iterator's remove method cannot be invoked directly -
remove
-
removeAll
-
retainAll
-
size
public int size() -
toArray
-
toArray
public <X> X[] toArray(X[] arg0) -
hashCode
public int hashCode() -
equals
-
toString
-