This week's book giveaway is in the Agile and other Processes forum.
We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes removing an object from an array Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » Beginning Java
Reply Bookmark "removing an object from an array" Watch "removing an object from an array" New topic
Author

removing an object from an array

Carie Herrick
Greenhorn

Joined: Sep 26, 2008
Posts: 16
I have 6 objects in my array which are filled with various data... I am tasked with "removing an object from an array by either shifting remaining objects to the start of the array, or putting the last object into the slot where the deleted object used to be." I know the index # of the array object that needs to be removed. After removed, I still have to call my array to look for the other objects.

Does this make sense to anyone and if so, any suggestions on how to attempt this?

Thanks!
Steve Luke
Bartender

Joined: Jan 28, 2003
Posts: 3032
    
    4

So you have two proposed methods of removing the object from an array. Which one do you want to use? Pick one. Then try to implement it and when you find a problem show us your work and we can help you fix it.


Steve
Carie Herrick
Greenhorn

Joined: Sep 26, 2008
Posts: 16
I don't know which one to use because I don't know how to implement either one. After researching, I found just to set the array index to null. Hoping this will work...
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 56183
    
  13

"Carie", please check your private messages for an important administrative matter.


[Smart Questions] [JSP FAQ] [Books by Bear] [Bear's FrontMan] [About Bear]
Gamini Sirisena
Ranch Hand

Joined: Aug 05, 2008
Posts: 347
See if this helps.
 
I agree. Here's the link: http://zeroturnaround.com/jrebel - it saves me about five hours per week
 
subject: removing an object from an array
 
Similar Threads
JTree reload question, AGAIN
Get java.util.List from webservice
cannot resolve symbol
Arrays and GC
Casting Object[] into String[]