I would like to ask, if there is a way to print any other element from a LinkedList instead of first and last.
My idea:
I have created a button, and when click on it, i would like to show on textArea the first element, if clicked again the second and etc...
2 replies to this topic
#1
Posted 27 March 2011 - 09:48 AM
|
|
|
#2
Posted 27 March 2011 - 10:25 AM
If you're using Sun's implementation of a LinkedList you should be able to use the get(int index) method.
If you're using your own implementation you'll have to either add a method to your LinkedList or something else...
If you're using your own implementation you'll have to either add a method to your LinkedList or something else...
#3
Posted 28 March 2011 - 08:52 AM
you could have a look how sun implemented it in their version or simply implement it by a copy of the list (copy the list, remove til n+1 element, then refill ur original list)....
ask me if something remains unclear to u and ill try to explain in more detail ;-)
ask me if something remains unclear to u and ill try to explain in more detail ;-)
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users


Sign In
Create Account


Back to top









