• Post Reply Bookmark Topic Watch Topic
  • New Topic

Returning start value  RSS feed

 
Kristers Drozds
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well i got question:
1. How to return beginning value to
so when i use getFirst() method it shows second value - cause of .removeFirst();.removeLast();

 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 37513
554
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The removeFirst() method returns the start value in addition to removing it. For example:



Note that it is Java convention to have classnames begin with a capital letter along with subsequent "words" rather than using underscores. Making your class name KristersDrozds3.
 
Kristers Drozds
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Jeanne Boyarsky wrote:The removeFirst() method returns the start value in addition to removing it. For example:



Note that it is Java convention to have classnames begin with a capital letter along with subsequent "words" rather than using underscores. Making your class name KristersDrozds3.


Thanks for reply, well that dont work for me cause i need to display 10 methods.
for example :


Object tre will take first list value


but i want to make it so it takes firsts value of list.


im bit confused.
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 37513
554
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't understand. first has the value you want already. So why do you want it in tre?

Note that be the time you call getFirst(), you have already removed the first value from the list. SO you are getting the next one. If you called getFirst() before calling remove(), it would get what you need.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!