C
clusardi2k
Below uses a List of objects of class Route. Class Route has public member variables (such as locationid) and public methods (such as get_locationid()). The below code is a first attempt at a way to obtain the value of locationid using casting. Question: What is the code to do it a better way.
((Route)objList.get(0)).locationid;
((Route)objList.get(1)).locationid;
The below start of replacement code fails because it skips through the list.. There wasn't a good reason for me to finish the code! The loop can't eveniterate the required number of loops.
Iterator <Route> it = objList.iterator();
int size = objList.size();
for (int i = 0;i < size; i++)
{
it.next();
}
Thank you,
((Route)objList.get(0)).locationid;
((Route)objList.get(1)).locationid;
The below start of replacement code fails because it skips through the list.. There wasn't a good reason for me to finish the code! The loop can't eveniterate the required number of loops.
Iterator <Route> it = objList.iterator();
int size = objList.size();
for (int i = 0;i < size; i++)
{
it.next();
}
Thank you,