Java Collections fill value to List
import java.util.Collections; import java.util.Iterator; import java.util.LinkedList; import java.util.List; public class Main { public static void main(String[] args) { String[] langArray = { "CSS", "HTML", "C++", "Dart", "SQL" }; List<String> list = new LinkedList<>(); for (int i = 0; i < langArray.length; i++){ list.add(langArray[i]);//from w w w .j a v a 2 s.c o m } System.out.println(list); Collections.fill(list, "demo2s.com"); Iterator<String> liter = list.listIterator(); while (liter.hasNext()) System.out.println(liter.next()); list.add("new value"); System.out.println(list); } }