Remove element from a vector

ReturnMethodSummary
Eremove(int index)Removes the element at the specified position in this Vector.
booleanremove(Object o)Removes the first occurrence of the specified element in this Vector If the Vector does not contain the element, it is unchanged.
boolean removeAll(Collection<?> c) Removes from this Vector all of its elements that are contained in the specified Collection.
voidremoveAllElements()Removes all components from this vector and sets its size to zero.
booleanremoveElement(Object obj)Removes the first (lowest-indexed) occurrence of the argument from this vector.
voidremoveElementAt(int index)Deletes the component at the specified index.

import java.util.Vector;

public class Main{

  public static void main(String args[]) {

    Vector v = new Vector();

    v.add("java2s.com");
    v.add("java2s.com");
    v.add("java2s.com");
    

    v.remove(0);
    
    System.out.println(v);
  }
}

The output:


[java2s.com, java2s.com]
java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.