Does a HashSet make an internal copy of added Objects?
- by praks5432
Let's say I have a function that is recursive and is like this
public void someRecur(List<Integer>someList){
if(someBreakCondition)
Set.add(someList);
for(int i = 0; i < someLen ; i++){
someList.add(someInt);
someRecur(someList);
someList.remove(someInt);
}
}
Does the remove affect the list that has been put into the set? What should I do to give the set an actual copy of the list?