Does a HashSet make an internal copy of added Objects?
Posted
by
praks5432
on Stack Overflow
See other posts from Stack Overflow
or by praks5432
Published on 2012-10-24T10:53:47Z
Indexed on
2012/10/24
11:00 UTC
Read the original article
Hit count: 217
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?
© Stack Overflow or respective owner