aspose file tools
The moose likes Beginning Java and the fly likes Removing Elements From an Array Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Removing Elements From an Array" Watch "Removing Elements From an Array" New topic

Removing Elements From an Array

Landon Blake
Ranch Hand

Joined: Dec 04, 2003
Posts: 121
I need to know the proper syntax for removal of an element from a vector. Do I have this correct?
I have an object that contains a Vector of Strings named dataType.
I have an int variable named elementNumber that specifies the location of the element I want to remove.
Would I call the following method to remove the String Object?
fred rosenberger
lowercase baba

Joined: Oct 02, 2003
Posts: 11648

from the API
public Object remove(int index)
Removes the element at the specified position in this Vector. shifts any subsequent elements to the left (subtracts one from their indices). Returns the element that was removed from the Vector.

There are only two hard things in computer science: cache invalidation, naming things, and off-by-one errors
I agree. Here's the link:
subject: Removing Elements From an Array