This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
The moose likes Beginning Java and the fly likes Array List Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Array List" Watch "Array List" New topic
Author

Array List

Ransika deSilva
Ranch Hand

Joined: Feb 18, 2003
Posts: 524
Hello world,
I just wanted to know this. I have an array list of objects of the same class type. For example item details of a bill. Now i want to delete the 5th element(10elements are there). If I delete the 5th element what will happen to the element numbers of the array list. I mean the 6th element will it become the 5th element in the array list after deleting, the 5th element.
Hope you got what I mean.
Thanks


SCJP 1.4, SCMAD 1.0<br />SCWCD, SCBCD (in progress)
Joel McNary
Bartender

Joined: Aug 20, 2001
Posts: 1817

You are correct. If you remove the fifth element, then the sixth element becomes the fifth element, the seventh becomes the sixth, etc. In addition, the size of the array becomes 9.


Piscis Babelis est parvus, flavus, et hiridicus, et est probabiliter insolitissima raritas in toto mundo.
Ransika deSilva
Ranch Hand

Joined: Feb 18, 2003
Posts: 524
Thanks for the reply. I just wanted to make sure what I had in my mind correct.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Array List