Class SortedScheduledEntries<K,V extends Comparable<? super V>>
java.lang.Object
org.wildfly.clustering.ee.cache.scheduler.SortedScheduledEntries<K,V>
- All Implemented Interfaces:
Iterable<Map.Entry<K,,V>> ScheduledEntries<K,V>
public class SortedScheduledEntries<K,V extends Comparable<? super V>>
extends Object
implements ScheduledEntries<K,V>
ScheduledEntries implemented using a ConcurrentSkipListSet, where entries are sorted based on the entry value.
Both add(Object, Comparable) and remove(Object) run in O(log N) time.- Author:
- Paul Ferraro
-
Constructor Summary
ConstructorsConstructorDescriptionCreates a new entries object whose iteration order is based on the entry value.SortedScheduledEntries(Comparator<Map.Entry<K, V>> comparator) Creates a new entries object whose iteration order is based on the specified comparator. -
Method Summary
Modifier and TypeMethodDescriptionvoidAdds an entry using the specified key and value.booleanIndicates whether specified key exists among the scheduled entries.voidbooleanisSorted()Indicates whether the entries are sorted, or if iteration order recapitulates insertion order.iterator()peek()Returns, but does not remove, the first entry.voidRemoves the entry with the specified key.stream()Returns a stream of scheduled entries.toString()
-
Constructor Details
-
SortedScheduledEntries
public SortedScheduledEntries()Creates a new entries object whose iteration order is based on the entry value. -
SortedScheduledEntries
Creates a new entries object whose iteration order is based on the specified comparator.- Parameters:
comparator- the comparator used to determine the iteration order
-
-
Method Details
-
isSorted
public boolean isSorted()Description copied from interface:ScheduledEntriesIndicates whether the entries are sorted, or if iteration order recapitulates insertion order.- Specified by:
isSortedin interfaceScheduledEntries<K,V extends Comparable<? super V>> - Returns:
- true, if these entries are sorted, false otherwise.
-
add
Description copied from interface:ScheduledEntriesAdds an entry using the specified key and value.- Specified by:
addin interfaceScheduledEntries<K,V extends Comparable<? super V>> - Parameters:
key- an entry keyvalue- an entry value
-
remove
Description copied from interface:ScheduledEntriesRemoves the entry with the specified key.- Specified by:
removein interfaceScheduledEntries<K,V extends Comparable<? super V>> - Parameters:
key- an entry key
-
contains
Description copied from interface:ScheduledEntriesIndicates whether specified key exists among the scheduled entries.- Specified by:
containsin interfaceScheduledEntries<K,V extends Comparable<? super V>> - Parameters:
key- an entry key- Returns:
- true, if the key is a scheduled entry, false otherwise
-
peek
Description copied from interface:ScheduledEntriesReturns, but does not remove, the first entry.- Specified by:
peekin interfaceScheduledEntries<K,V extends Comparable<? super V>>
-
stream
Description copied from interface:ScheduledEntriesReturns a stream of scheduled entries.- Specified by:
streamin interfaceScheduledEntries<K,V extends Comparable<? super V>> - Returns:
- a stream of scheduled entries.
-
iterator
- Specified by:
iteratorin interfaceIterable<K>- Specified by:
iteratorin interfaceScheduledEntries<K,V extends Comparable<? super V>>
-
forEach
-
spliterator
- Specified by:
spliteratorin interfaceIterable<K>
-
toString
-