Package org.arakhne.afc.references
Class ComparableSoftReference<T>
- java.lang.Object
-
- java.lang.ref.Reference<T>
-
- java.lang.ref.SoftReference<T>
-
- org.arakhne.afc.references.ComparableSoftReference<T>
-
- Type Parameters:
T
- is the type of the referenced object.
- All Implemented Interfaces:
Comparable<Object>
public class ComparableSoftReference<T> extends SoftReference<T> implements Comparable<Object>
This class is a WeakReference that allows to be compared on its pointed value.- Version:
- 17.0 2020-01-04 14:41:38
- Author:
- Stéphane GALLAND
- Maven Group Id:
- org.arakhne.afc.core
- Maven Artifact Id:
- references
-
-
Constructor Summary
Constructors Constructor Description ComparableSoftReference(T referent)
Constructor.ComparableSoftReference(T referent, ReferenceQueue<? super T> queue)
Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
compareTo(Object obj)
Compare this reference to the specified object based on theObject.hashCode()
if the references are not equals.boolean
equals(Object obj)
int
hashCode()
String
toString()
-
Methods inherited from class java.lang.ref.SoftReference
get
-
Methods inherited from class java.lang.ref.Reference
clear, clone, enqueue, isEnqueued, reachabilityFence
-
-
-
-
Constructor Detail
-
ComparableSoftReference
public ComparableSoftReference(T referent)
Constructor.- Parameters:
referent
- is the referenced object.
-
ComparableSoftReference
public ComparableSoftReference(T referent, ReferenceQueue<? super T> queue)
Constructor.- Parameters:
referent
- is the referenced object.queue
- is the object that will be notified of the memory released for the referenced object.
-
-
Method Detail
-
compareTo
@Pure public int compareTo(Object obj)
Compare this reference to the specified object based on theObject.hashCode()
if the references are not equals.- Specified by:
compareTo
in interfaceComparable<T>
- Parameters:
obj
-- Returns:
-
-