Making a list unmodifiable
The list unmodifiable method is used to returns an unmodifiable view of the specified list. The Collections class provides a way to make a list unmodifiable: List ls = new ArrayList();List unmodifiableList = Collections.unmodifiableList(ls); If you want an unmodifiable list with one item you can use: List unmodifiableList = Collections.singletonList(“Only string in the list”); Moving objects around … Read more