Why do i get different behaviors with:
Collection col2 = new ArrayList(col);
Collection col2 = new ArrayList();
public List getAdminImIdsWithValidShortNames(){
return adminImIdsWithValidShortNames;
}
public void setAdminImIdsWithValidShortNames(List adminImIdsWithValidShortNames){
this.adminImIdsWithValidShortNames=adminImIdsWithValidShortNames;
}
I think, easy is beautiful, just generator setter/getter method is a good habit. if you first clear, then addAll, the list need to clear all elements of list, then addAll will be extra backing array expansion operation, that's not science.
just replacement, this variable will be point to new List, the old list will be auto-GC.