Collections: unmodifiableCollection(Collection c) : Collections « java.util « Java by API

Collections: unmodifiableCollection(Collection c)

import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.List;

public class Main {

  public static void main(String args[]) {
    List<Character> list = new ArrayList<Character>();


    System.out.println("Element added to list: " + list.get(0));

    Collection<Character> immutableCol = Collections.unmodifiableCollection(list);



Related examples in the same category

4.Collections: binarySearch(List list, T key)
5.Collections: comparator()
6.Collections: copy(List dest, List src)
7.Collections: emptyList()
8.Collections: emptyMap()
9.Collections: emptySet()
10.Collections: enumeration(Collection c)
11.Collections: fill(List list, R obj)
12.Collections: list(Enumeration e)
13.Collections: max(Collection < ? extends T > coll)
14.Collections: min(Collection < ? extends T > coll)
15.Collections: nCopies(int n, Object o)
16.Collections: reverse(List list)
17.Collections: reverseOrder()
18.Collections: replaceAll(List list, T oldVal, T newVal)
19.Collections: rotate(List list, int distance)
20.Collections: shuffle(List < ? > list,Random rnd)
21.Collections: singleton(T o)
22.Collections: singletonList(T o)
23.Collections: singletonMap(T key, R value)
24.Collections: sort(List list)
25.Collections: sort(List < T > list, Comparator < ? super T > c)
26.Collections: swap(List list, int i, int j)
27.Collections: synchronizedCollection(Collection c)
28.Collections: synchronizedList(List list)
29.Collections: synchronizedMap(Map m)
30.Collections: synchronizedSet(Set s)
31.Collections: synchronizedSet(SortedSet s)
32.Collections: synchronizedSortedMap(SortedMap m)
33.Collections: unmodifiableList(List list)
34.Collections: unmodifiableMap(Map m)
35.Collections: unmodifiableSet(Set s)