Package org.eclipse.sisu.inject
Class MildElements<T>
java.lang.Object
java.util.AbstractCollection<T>
org.eclipse.sisu.inject.MildElements<T>
- All Implemented Interfaces:
Iterable<T>
,Collection<T>
NON-thread-safe
Collection
of elements kept alive by soft/weak Reference
s.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static interface
Represents an element that can be indexed.(package private) final class
private static final class
SoftMildElements.Indexable
element.private static final class
WeakMildElements.Indexable
element. -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Methods inherited from class java.util.AbstractCollection
addAll, clear, contains, containsAll, isEmpty, remove, removeAll, retainAll, toArray, toArray, toString
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.util.Collection
equals, hashCode, parallelStream, removeIf, spliterator, stream, toArray
-
Field Details
-
queue
-
list
-
soft
private final boolean soft
-
-
Constructor Details
-
MildElements
-
-
Method Details
-
add
- Specified by:
add
in interfaceCollection<T>
- Overrides:
add
in classAbstractCollection<T>
-
size
public int size()- Specified by:
size
in interfaceCollection<T>
- Specified by:
size
in classAbstractCollection<T>
-
iterator
- Specified by:
iterator
in interfaceCollection<T>
- Specified by:
iterator
in interfaceIterable<T>
- Specified by:
iterator
in classAbstractCollection<T>
-
compact
private void compact()Compacts the list by replacing unreachableReference
s with ones from the end. -
evict
Evicts a singleReference
from the list; replacing it with one from the end.- Parameters:
ref
- The reference to evict
-