Java List copyOf method
Java List copyOf method Example copyOf method added in jdk10. Returns an unmodifiable List containing the elements of the given Collection, in its iteration order. The given Collection must not be null, and it must not contain any null elements. If the given Collection is subsequently modified, the returned List will not reflect such modifications. Implementation Note: If the given Collection is an unmodifiable List, calling copyOf will generally not create a copy. Method: static <E> List<E> copyOf(Collection<? extends E> coll) Implementation Note: If the given Collection is an unmodifiable List, calling copyOf will generally not create a copy. Type Parameters: E - the List's element type Parameters: coll - a Collection from which elements are drawn, must be non-null Returns: a List containing the elements of the given Collection Throws: NullPointerException - if coll is null, or if it contains any nulls Example: class copyOfExample{ p...