List of utility methods to do Object Deep Clone
T | deepCloneOnlyIfContains(final T objectToBeClonned, final T[] objects) clones only if objects contains the given objectToBeClonned , otherwise returns the same object. if (objectToBeClonned == null || objects == null) { return objectToBeClonned; final Set<T> objectsSet = new HashSet<T>(Arrays.asList(objects)); return objectsSet.contains(objectToBeClonned) ? deepClone(objectToBeClonned) : objectToBeClonned; |