public final class WeakSoftTable extends Object
Modifier and Type | Class and Description |
---|---|
static interface |
WeakSoftTable.RemovableReference
Implemented by classes to permit copying instances into reference queues
when they are added to the table and to remove them from the table when
the references are cleared.
|
static class |
WeakSoftTable.SoftValue
A value that maintains a soft reference to an object.
|
static class |
WeakSoftTable.WeakKey
A key that maintains a weak reference to an object which should be
compared by object identity.
|
Modifier and Type | Field and Description |
---|---|
private Map |
hash
Hash table mapping WeakKeys to Lists of SoftValues.
|
private ReferenceQueue |
queue
Reference queue for cleared keys and values.
|
Constructor and Description |
---|
WeakSoftTable()
Creates an instance of this class.
|
Modifier and Type | Method and Description |
---|---|
void |
add(WeakSoftTable.WeakKey key,
WeakSoftTable.SoftValue value)
Associates an additional value with the specified key.
|
WeakSoftTable.SoftValue |
get(WeakSoftTable.WeakKey key,
int index)
Returns the value associated with the specified key and index, or null
if not found.
|
private void |
processQueue()
Removes all invalidated entries from the map, that is, removes all
entries whose keys or values have been discarded.
|
WeakSoftTable.SoftValue |
remove(WeakSoftTable.WeakKey key,
int index)
Removes and returns the index'th value associated with the specified
key.
|
String |
toString()
Returns a string representation of this object.
|
private final Map hash
private final ReferenceQueue queue
private void processQueue()
public WeakSoftTable.SoftValue get(WeakSoftTable.WeakKey key, int index)
public void add(WeakSoftTable.WeakKey key, WeakSoftTable.SoftValue value)
public WeakSoftTable.SoftValue remove(WeakSoftTable.WeakKey key, int index)
Copyright 2007-2013, multiple authors.
Licensed under the Apache License, Version 2.0, see the NOTICE file for attributions.