public static Configuration copyConfiguration ( final Configuration original ) { Configuration copy = new MapConfiguration ( new HashMap < String , Object > ( ) ) ; for ( Iterator < ? > i = original . getKeys ( ) ; i . hasNext ( ) ; ) { String key = ( String ) i . next ( ) ; Object value = original . getProperty ( key ) ; if ( value instanceof List ) { value = new ArrayList ( ( List ) value ) ; } copy . setProperty ( key , value ) ; } return copy ; }
Creates a deep - copy of the given configuration . This is useful for unit - testing .