How do I insert an item into LinkedList?
Category: java.util, viewed: 384 time(s).
To insert an item at any position into a linked list object we can use the add(int index, Object o) method. This method takes the index to where the new object to be inserted and the object to be inserted itself.
The result of our program are:
Orignal values are: =================== Name = Alice Name = Bob Name = Mallory New values are: =================== Name = Alice Name = Bob Name = Carol Name = Mallory
Can't find what you are looking for? Join our FORUMS and ask some questions!
Download Hundreds of Complimentary Industry Resources
Get hundreds of popular Industry magazines, white papers, webinars, podcasts, and more;
all available at no cost to you. With more than 600 complimentary offers, you'll find
plenty of titles to suit your professional interests and needs.
Click Here and Sign up today!
