Hi2all!
Can some one help me out a bit, im trying to find a index of an object in a list under a iterator;
somwehre in the net i found some thing like that it.nextIndex()-1; but im using the iterator from java utility and it doesnt have nextIndex();
How to get the index of the object on which the iterator is pointing ?
How to get the index
Page 1 of 16 Replies - 1058 Views - Last Post: 11 July 2012 - 04:15 AM
Replies To: How to get the index
#2
Re: How to get the index
Posted 10 July 2012 - 11:47 PM
Use a counter variable inside your iteration?
#3
Re: How to get the index
Posted 11 July 2012 - 12:41 AM
#4
Re: How to get the index
Posted 11 July 2012 - 12:58 AM
No problem dude! Just tell us if something goes wrong or something.
#5
Re: How to get the index
Posted 11 July 2012 - 01:16 AM
#6
Re: How to get the index
Posted 11 July 2012 - 03:53 AM
If you need the index, simply don't use an Iterator
for(int index = 0; index < list.size(); ++index)
will do the job as well and explains better what you try to do
for(int index = 0; index < list.size(); ++index)
will do the job as well and explains better what you try to do
#7
Re: How to get the index
Posted 11 July 2012 - 04:15 AM
Page 1 of 1
|
|

New Topic/Question
Reply



MultiQuote





|