public static < T > Set < T > copy ( final Set < T > set ) { if ( set == null ) { return null ; } TypeEnum elementType = null ; Set < T > copy = new HashSet < T > ( ) ; for ( T element : set ) { T elementCopy = null ; if ( element != null ) { if ( elementType == null ) { elementType = TypeEnum . dataTypeOf ( element . getClass ( ) ) ; } elementCopy = copy ( element , elementType ) ; } copy . add ( elementCopy ) ; } return copy ; }
Returns a deep copy of a pdef set .