Package com.privatejgoodies.common.base
Class Objects
- java.lang.Object
-
- com.privatejgoodies.common.base.Objects
-
public final class Objects extends java.lang.Object
Provides static methods that operate on objects.- Author:
- Karsten Lentzsch
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static <T extends java.io.Serializable>
TdeepCopy(T original)
Provides a means to copy objects that do not implement Cloneable.static boolean
equals(java.lang.Object o1, java.lang.Object o2)
Checks and answers if the two objects are bothnull
or equal.
-
-
-
Method Detail
-
deepCopy
public static <T extends java.io.Serializable> T deepCopy(T original)
Provides a means to copy objects that do not implement Cloneable. Performs a deep copy where the copied object has no references to the original object for any object that implements Serializable. If the original isnull
, this method just returnsnull
.- Type Parameters:
T
- the type of the object to be cloned- Parameters:
original
- the object to copied, may benull
- Returns:
- the copied object
- Since:
- 1.1.1
-
equals
public static boolean equals(java.lang.Object o1, java.lang.Object o2)
Checks and answers if the two objects are bothnull
or equal.Objects.equals(null, null) == true Objects.equals("Hi", "Hi") == true Objects.equals("Hi", null) == false Objects.equals(null, "Hi") == false Objects.equals("Hi", "Ho") == false
- Parameters:
o1
- the first object to compareo2
- the second object to compare- Returns:
- boolean
true
if and only if both objects arenull
or equal according toequals
invoked on the first object
-
-