when there is a
lot of array or list is provided you need to replace a particular
element by searching automatically.
import java.util.*; public class Main { public static void main(String[] args) { List list = Arrays.asList("this is the list to be replaced one Two three Four five six one three Four ".split(" ")); System.out.println("List :"+list); Collections.replaceAll(list, "one", "hundread"); System.out.println("replaceAll: " + list); } }