List of usage examples for java.util Vector capacity
public synchronized int capacity()
From source file:MainClass.java
public static void main(String args[]) { Vector v = new Vector(5); for (int i = 0; i < 10; i++) { v.add(i, 0);//from w w w . j ava 2 s . c o m } System.out.println(v.capacity()); System.out.println(v); v.clear(); System.out.println(v); System.out.println(v.capacity()); }
From source file:Main.java
public static void main(String args[]) { Vector v = new Vector(5); for (int i = 0; i < 10; i++) { v.add(0, i);/* w w w . j av a2 s . co m*/ } System.out.println(v.capacity()); System.out.println(v); v.remove(1); v.removeElementAt(2); System.out.println(v); System.out.println(v.capacity()); }
From source file:Main.java
public static void main(String args[]) { Vector v = new Vector(5); for (int i = 0; i < 10; i++) { v.add(0, i);//from www. j a v a 2 s . com } System.out.println(v.capacity()); System.out.println(v); v.remove(new Integer(9)); v.removeElement(new Integer(2)); System.out.println(v); System.out.println(v.capacity()); }
From source file:MainClass.java
public static void main(String args[]) { // initial size is 3, increment is 2 Vector<Integer> v = new Vector<Integer>(3, 2); System.out.println("Initial size: " + v.size()); System.out.println("Initial capacity: " + v.capacity()); v.addElement(1);/*from w ww.ja v a 2 s .c o m*/ v.addElement(2); System.out.println("First element: " + v.firstElement()); System.out.println("Last element: " + v.lastElement()); if (v.contains(3)) System.out.println("Vector contains 3."); }
From source file:CreateVector.java
public static void main(String args[]) { {/*from ww w .jav a 2s . c om*/ Vector v = new Vector(0); System.out.println(v.capacity()); v.addElement("Hello"); System.out.println(v.capacity()); v.addElement("Hello"); System.out.println(v.capacity()); v.addElement("Hello"); System.out.println(v.capacity()); v.addElement("Hello"); System.out.println(v.capacity()); v.addElement("Hello"); System.out.println(v.capacity()); } { Vector v = new Vector(); System.out.println(v.capacity()); v.addElement("Hello"); System.out.println(v.capacity()); v.addElement("Hello"); System.out.println(v.capacity()); v.addElement("Hello"); System.out.println(v.capacity()); v.addElement("Hello"); System.out.println(v.capacity()); v.addElement("Hello"); System.out.println(v.capacity()); v.addElement("Hello"); System.out.println(v.capacity()); v.addElement("Hello"); System.out.println(v.capacity()); v.addElement("Hello"); System.out.println(v.capacity()); v.addElement("Hello"); System.out.println(v.capacity()); v.addElement("Hello"); System.out.println(v.capacity()); v.addElement("Hello"); System.out.println(v.capacity()); v.addElement("Hello"); System.out.println(v.capacity()); v.addElement("Hello"); System.out.println(v.capacity()); v.addElement("Hello"); System.out.println(v.capacity()); v.addElement("Hello"); System.out.println(v.capacity()); v.addElement("Hello"); System.out.println(v.capacity()); v.addElement("Hello"); System.out.println(v.capacity()); v.addElement("Hello"); System.out.println(v.capacity()); v.addElement("Hello"); System.out.println(v.capacity()); v.addElement("Hello"); System.out.println(v.capacity()); v.addElement("Hello"); System.out.println(v.capacity()); v.addElement("Hello"); System.out.println(v.capacity()); v.addElement("Hello"); System.out.println(v.capacity()); v.addElement("Hello"); System.out.println(v.capacity()); v.addElement("Hello"); System.out.println(v.capacity()); v.addElement("Hello"); System.out.println(v.capacity()); v.addElement("Hello"); System.out.println(v.capacity()); v.addElement("Hello"); System.out.println(v.capacity()); v.addElement("Hello"); System.out.println(v.capacity()); v.addElement("Hello"); System.out.println(v.capacity()); v.addElement("Hello"); System.out.println(v.capacity()); v.addElement("Hello"); System.out.println(v.capacity()); v.addElement("Hello"); System.out.println(v.capacity()); v.addElement("Hello"); System.out.println(v.capacity()); v.addElement("Hello"); System.out.println(v.capacity()); v.addElement("Hello"); System.out.println(v.capacity()); v.addElement("Hello"); System.out.println(v.capacity()); v.addElement("Hello"); System.out.println(v.capacity()); v.addElement("Hello"); System.out.println(v.capacity()); v.addElement("Hello"); System.out.println(v.capacity()); } }
From source file:Main.java
public static void main(String[] args) { // create an empty Vector vec Vector<Integer> vec = new Vector<Integer>(); vec.add(14);// w w w.java 2 s. c o m vec.add(13); vec.add(12); vec.add(11); vec.add(4); vec.add(3); vec.add(2); vec.add(1); // let us print the capacity of the vector System.out.println("Capacity of the vector is :" + vec.capacity()); }
From source file:de.unibayreuth.bayeos.goat.table.OctetMatrixTableModel.java
private Vector getIds(Vector s) { Iterator it = s.iterator();//ww w . j a v a 2 s . co m Vector ret = new Vector(s.capacity()); while (it.hasNext()) { ret.add(((ObjektNode) it.next()).getId()); } return ret; }