Java examples for Collection Framework:Vector
Replace all occurrences of specified element of Vector using Collections.replaceAll
import java.util.Vector; import java.util.Collections; public class Main { public static void main(String[] args) { //from w ww .j av a 2 s. c o m Vector v = new Vector(); v.add("A"); v.add("B"); v.add("A"); v.add("C"); v.add("D"); System.out.println("Vector Contains : " + v); Collections.replaceAll(v, "A","Replace All"); System.out.println("After Replace All, Vector Contains : " + v); } }