I have difficulties in understanding the following error.
Suppose you have a class A in which I implement the following method:
Map<Double,Integer> get_friends(double user){
Map<Double,Integer> friends = user_to_user.row(user);
//friends.putAll(user_to_user.column(user));
return friends;}
Then in the main I do the following:
A obj = new A();
Map<Double,Integer> temp = obj.get_friends(6);
Well this works fine. However when I uncomment the follwing line in class A:
friends.putAll(user_to_user.column(user));
and I run again the program, it crashes and throws me the concurrentModificationException.
It is to be noted, that I am creating the Table user_to_user as follows:
private HashBasedTable<Double,Double,Integer> user_to_user;//
user_to_user = HashBasedTable.create();
What is further surprising is that when I interchange the way I am filling friends, I mean in that way:
Map<Double,Integer> friends = user_to_user.column(user);
friends.putAll(user_to_user.row(user));
Then everyting will work fine.
Any idea ?