Java List throws UnsupportedOperationException
Typically, we use Arrays.asList or the new Java 9 List.of to create a List. However, both methods return a fixed size or immutable List, it means we can’t modify it, else it throws UnsupportedOperationException. JavaListExample.java package com.mkyong; import java.util.Arrays; import java.util.List; public class JavaListExample { public static void main(String[] args) { // immutable list, cant …