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 References.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static interfaceRepresents an element that can be indexed.(package private) final classprivate static final classSoftMildElements.Indexableelement.private static final classWeakMildElements.Indexableelement. -
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, toStringMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods 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:
addin interfaceCollection<T>- Overrides:
addin classAbstractCollection<T>
-
size
public int size()- Specified by:
sizein interfaceCollection<T>- Specified by:
sizein classAbstractCollection<T>
-
iterator
- Specified by:
iteratorin interfaceCollection<T>- Specified by:
iteratorin interfaceIterable<T>- Specified by:
iteratorin classAbstractCollection<T>
-
compact
private void compact()Compacts the list by replacing unreachableReferences with ones from the end. -
evict
Evicts a singleReferencefrom the list; replacing it with one from the end.- Parameters:
ref- The reference to evict
-