Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Array List

 
Ransika deSilva
Ranch Hand
Posts: 524
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Joel McNary
Bartender
Posts: 1840
Eclipse IDE Java Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Ransika deSilva
Ranch Hand
Posts: 524
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the reply. I just wanted to make sure what I had in my mind correct.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic