Click here to watch in Youtube :
https://www.youtube.com/watch?v=2mY1uLNwcpI&list=UUhwKlOVR041tngjerWxVccw
import java.util.Vector; /* * Example of removeElementAt(int index) method. */ public class VectorExample { public static void main( String[] args ) { Vector<Integer> vector = new Vector<Integer>(); vector.add(50); vector.add(100); vector.add(150); vector.add(200); System.out.println("vector : " + vector + "\n"); /* * Deletes the component at the specified index. Each component in this * vector with an index greater or equal to the specified index is * shifted downward to have an index one smaller than the value it had * previously. The size of this vector is decreased by 1. * * The index must be a value greater than or equal to 0 and less than the current size * of the vector. * * This method is identical in functionality to the remove(int) method * (which is part of the List interface). Note that the remove method * returns the old value that was stored at the specified position. */ vector.removeElementAt(2); System.out.println("vector : " + vector + "\n"); } }
vector : [50, 100, 150, 200] vector : [50, 100, 200]
https://sites.google.com/site/javaee4321/java-collections/VectorDemoRemoveElementAt.zip?attredirects=0&d=1
See also:
No comments:
Post a Comment