Online Java Compiler By
JavaTpoint.com
import java.util.*; public class CollectionsNCopiesExample3 { public static void main(String[] args) { List
list = Collections.nCopies(5,"SSSIT.COM"); System.out.println("List elements: "); Iterator
it = list.iterator(); while(it.hasNext()) System.out.println(it.next()); } }
Output