Package jmri
Class Reference<E>
- java.lang.Object
-
- jmri.Reference<E>
-
- Type Parameters:
E
- the type of the reference
public class Reference<E> extends java.lang.Object
A reference to an object. It's a faster replacement for AtomicReference when thread safety is not needed.
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description E
get()
Return the reference.void
set(E ref)
Set the reference.
-
-
-
Constructor Detail
-
Reference
public Reference()
Create an instance of Reference.
-
Reference
public Reference(@CheckForNull E ref)
Create an instance of Reference.- Parameters:
ref
- the reference
-
-
Method Detail
-
set
public void set(@CheckForNull E ref)
Set the reference.- Parameters:
ref
- the new reference
-
get
@CheckReturnValue @CheckForNull public E get()
Return the reference.- Returns:
- the reference
-
-