Online Java Compiler By
JavaTpoint.com
import java.util.*; public class CollectionsReplaceAllExample3 { public static void main(String[] args) { //Create an list of integers List
list = Arrays.asList("10", "20", "10", "40", "50", "10"); System.out.println("Original List: " +list); boolean b = Collections.replaceAll(list, "10", "400"); System.out.println("Boolean: "+b); System.out.println("Value after Replace: " +list); } }
Output