Java examples for Collection Framework:Vector
Replace All Elements Of Vector
import java.util.Vector; import java.util.Collections; public class Main { public static void main(String[] args) { Vector v = new Vector(); /* w w w . j av a2s .c o m*/ v.add("A"); v.add("B"); v.add("D"); System.out.println("Before replacement, Vector contains : " + v); Collections.fill(v,"REPLACED"); System.out.println("After replacement, Vector contains : " + v); } }