wffweb/src/main/java/com/webfirmframework/wffweb/clone/CloneUtil.java
public static <T> T deepCloneOnlyIfContains(final T objectToBeClonned,
            final Set<T> objects) throws CloneNotSupportedException {
        if (objectToBeClonned == null || objects == null) {
            return objectToBeClonned;
        }
        return objects.contains(objectToBeClonned)
                ? deepClone(objectToBeClonned)
                : objectToBeClonned;
    }
public static <T> T deepCloneOnlyIfContains(final T objectToBeClonned,
            final Set<T> objects) throws CloneNotSupportedException {
        if (objectToBeClonned == null || objects == null) {
            return objectToBeClonned;
        }
        return objects.contains(objectToBeClonned)
                ? deepClone(objectToBeClonned)
                : objectToBeClonned;
    }
clones only if {@code objects} contains the given
{@code objectToBeClonned}, otherwise returns the same object.

@param objectToBeClonned
from which a new object will be cloned.
{@code null} will be returned for null
value.
@param objects
to check if it contains
{@code objectToBeClonned}.
@return the new cloned object only if {@code objects} contains the given
{@code objectToBeClonned}, otherwise returns the same object. If
{@code objectToBeClonned} is null then returns {@code null}. If
{@code objects} is null then {@code objectToBeClonned} will be
returned.
@throws CloneNotSupportedException
@since 1.0.0
@author WFF