com.jgoodies.common.base

Class Objects

public final class Objects extends Object

Provides static methods that operate on objects.

Version: $Revision: 1.7 $

Author: Karsten Lentzsch

Method Summary
static <T extends Serializable> TdeepCopy(T original)
Provides a means to copy objects that do not implement Cloneable.
static booleanequals(Object o1, Object o2)
Checks and answers if the two objects are both {@code null} or equal.

Method Detail

deepCopy

public static <T extends 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 is {@code null}, this method just returns {@code null}.

Parameters: the type of the object to be cloned original the object to copied, may be {@code null}

Returns: the copied object

Since: 1.1.1

equals

public static boolean equals(Object o1, Object o2)
Checks and answers if the two objects are both {@code null} 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 compare o2 the second object to compare

Returns: boolean {@code true} if and only if both objects are {@code null} or equal according to Object#equals(Object) equals invoked on the first object

Copyright © 2009-2010 JGoodies Karsten Lentzsch. All Rights Reserved.