java.lang.Object | |
↳ | com.pnfsoftware.jeb.util.concurrent.WeakConcurrentSet<V> |
A thread-safe set with weak values. Entries are based on a key's system hash code and keys are considered equal only by reference equality.
This class does not implement the java.util.Set interface because this implementation is incompatible with the set contract. While iterating over a set's entries, any value that has not passed iteration is referenced non-weakly.
Nested Classes | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
enum | WeakConcurrentSet.Cleaner | Determines the cleaning format. |
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
WeakConcurrentSet(WeakConcurrentSet.Cleaner cleaner) |
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
boolean | add(V value) | ||||||||||
int |
approximateSize()
Returns the approximate size of this set where the returned number is at least as big as the
actual number of entries.
| ||||||||||
void |
clear()
Clears the set.
| ||||||||||
boolean | contains(V value) | ||||||||||
void |
expungeStaleEntries()
Cleans all unused references.
| ||||||||||
Thread | getCleanerThread() | ||||||||||
Iterator<V> | iterator() | ||||||||||
boolean | remove(V value) | ||||||||||
void | run() |
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
java.lang.Object
| |||||||||||
From interface
java.lang.Iterable
| |||||||||||
From interface
java.lang.Runnable
|
value | The value to add to the set. |
---|
true
if the value was added to the set and was not contained before.
Returns the approximate size of this set where the returned number is at least as big as the actual number of entries.
Clears the set.
value | The value to check if it is contained in the set. |
---|
true
if the set contains the value.
Cleans all unused references.
null
if no such thread was set.
value | The value to remove from the set. |
---|
true
if the value is contained in the set.