Package Torello.Java.Additional
Class ByRef<A>
- java.lang.Object
-
- Torello.Java.Additional.ByRef<A>
-
- Type Parameters:
A- Any type. ClassByRefserves as a wrapper for this type.
- All Implemented Interfaces:
java.lang.Cloneable
public class ByRef<A> extends java.lang.Object implements java.lang.Cloneable
A simple wrapper class for passing variables by-reference to methods calls.
Note that this class is substantively identical to the classEffectivelyFinal, but has a more apropos name.
Hi-Lited Source-Code:- View Here: Torello/Java/Additional/ByRef.java
- Open New Browser-Tab: Torello/Java/Additional/ByRef.java
File Size: 2,831 Bytes Line Count: 84 '\n' Characters Found
-
-
Constructor Detail
-
ByRef
-
ByRef
public ByRef()
Creates an instance of this class, and initializes the fieldthis.fto null.
-
-
Method Detail
-
toString
public java.lang.String toString()
Invokes the standardjava.lang.ObjectmethodtoString()on the fieldthis.f.- Overrides:
toStringin classjava.lang.Object- Returns:
- Returns the
Stringproduced by the contents'toString() - Code:
- Exact Method Body:
return f.toString();
-
hashCode
public int hashCode()
Invokes the standardjava.lang.ObjectmethodhashCode()on the fieldthis.f- Overrides:
hashCodein classjava.lang.Object- Returns:
- Returns the hash code produced by the contents'
hashCode(). - Code:
- Exact Method Body:
return f.hashCode();
-
clone
public ByRef<A> clone()
This creates a clone of the wrapper class.
NOTE: The field, itself, is not cloned. AnotherByRefwrapper is built, using the same internal field. Both the clone and'this'will share a pointer-reference to the same field.- Overrides:
clonein classjava.lang.Object- Returns:
- An
ByRef<A>clone. - Code:
- Exact Method Body:
return new ByRef<>(f);
-
equals
public boolean equals(java.lang.Object other)
This equality test checks whether both'this'and'other'share identical references. Equality between the contained / wrapped field'f'is not checked.
Ifthis.fandother.fhold different references, this method will returnFALSEeven if both of these references have Object-Equality.- Overrides:
equalsin classjava.lang.Object- Returns:
- Returns
TRUEif and only if'other'is an instance of'ByRef'andthis.f == other.f. This method checks for pointer-equality, rather than object-equality. - Code:
- Exact Method Body:
if (! (other instanceof ByRef)) return false; ByRef o = (ByRef) other; return this.f == o.f;
-
-