[Codenarc-developer] ExplicitHashMapInstantiation - copy of Map
Brought to you by:
chrismair
From: <chr...@wa...> - 2011-01-14 13:57:58
|
Hamlet, For ExplicitHashMapInstantiation, should there be a violation if you pass in a Map (or any variable) to the constructor of HashMap? I'm thinking not. Is there a better, idiomatic way to make a copy of a Map? Rule Name Priority Line # Source Line / Message ExplicitHashMapInstantiation 4 24 [SRC]def copyOfMap = new HashMap(map) def myMethod(Map map) { def copyOfMap = new HashMap(map) // ... } |