Hello all,
today i found a very strange situation of ArrayList - at least for me.
let's take 3 elementes that were put into list variable (list.add(point 1 -
3)):
Point(1,1);
Point(2,2);
Point(2,2);
list is an instance of ArrayList
foreach(Point p in list) {
Point p = (Point) list[list.indexOf(p)];
Console.Writeln( p.ToString());
}
in above example we will get only elements from 0 - 1
element (2) will be never printed cause list[list.indexOf(p)];
uses a hashcode (???) to find specified elements.
i have excpected searching no by hashcode but by reference (pointer to p).
it sounds very interesting... of course one can said that this is a lame or
invalid way of thinking...
but i had expected something else...
Adam