The Artima Developer Community
Sponsored Link

Legacy Java Answers Forum
April 2001

Advertisement

Advertisement

This page contains an archived post to the Java Answers Forum made prior to February 25, 2002. If you wish to participate in discussions, please visit the new Artima Forums.

Message:

Removing an element from a one dimensional array

Posted by Dean on May 14, 2001 at 5:57 PM

I am having trouble removing an element from an array. I can search and find the position in the array, but when I delete the position using:

data[position] = null;

There will be an empty position in the array. How do you get rid of this empty position?

Do you have to create a new array with its size one less than the previous, or is there an easier way.

P.S My array does not contain objects, it contains Integers.

Thanks in advance

Dean



Replies:

Sponsored Links



Google
  Web Artima.com   
Copyright © 1996-2009 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use - Advertise with Us