I normally do this to set a new Map to a private variable:
public static void setListaClausulas(Map<String, Clausula> nvLista) {
listaClausulas = new TreeMap<String, Clausula>(nvLista);
}
I suppose this is ok to set a new copy of the nvLista
and all it's members and not a reference, is it?
But now I have a Map inside another Map and I'm doing this:
public static void setListaClausulas(Map<String, Map<String, Clausula>> nvLista) {
listaClausulas = new TreeMap<String, Map<String, Clausula>>(nvLista);
}
Is this the correct way to do it or do you recommend something else? What I want is to set a new copy of nvLista
(and all it's elements) and not copy just the reference.