Creating n copies of the specified object

Returning an immutable list consisting of n copies of the specified object. The newly allocated data object is tiny (it contains a single reference to the data object). This method is useful in combination with the List.addAll method to grow lists. The returned list is serializable.

package collection.demos;

import java.util.Collections;

import java.util.List;

public class NewClass {

    public static void main(String[] args) {

        List<String> items=null;


        for (String string : items) {





No comments:

Popular Posts