Yellow Jersey schrieb:
> I cannot in particular understand the line marked "THIS LINE".
>
> int removedIndex = stocks.indexOf(symbol); // <- THIS LINE
List.indexOf(Object) looks for the position of a given object.
So without checking the actual source the implementiation in
e.g. ArrayList should be something like this:
public int indexOf(Object o){
for (int i = 0; i < elems.length; i++){
if (elems[i] == o){
return i;
}
}
return -1;
}
So the onClick-method looks for the position of the currently
added symbol (I assume that this part of code is embedded
in a loop that fills the stocksFlexTable) inside an internal
list, removes it from there:
> stocks.remove(removedIndex);
and continues by removing the symbol from a FlexTable that
contains a header-row in addition to the data-rows:
> stocksFlexTable.removeRow(removedIndex+1);
The internal list must contain the symbol, otherwise the whole
thing "crashes" because of list.remove(-1).
If you need more help about this you should change to a group
that covers that topic, e.g. in the comp.lang.java-hierarchy,
because this has nothing to do with GWT but with the Java-API.
Regards, Lothar
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Google Web Toolkit" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/Google-Web-Toolkit?hl=en
-~----------~----~----~----~------~----~------~--~---