package com.logicbig.example.collections;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
public class ReplaceAllExample {
public static void main(String... args) {
List<String> list = Arrays.asList("one", "two", "one");
System.out.println(list);
boolean b = Collections.replaceAll(list, "one", "three");
System.out.println(b);
System.out.println(list);
}
}
Output
[one, two, one]
true
[three, two, three]