We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
// Arrays public static <T> List<T> asList(T... a) { return new ArrayList<>(a); } /** * @serial include */ private static class ArrayList<E> extends AbstractList<E> implements RandomAccess, java.io.Serializable { ... // ArrayList public class ArrayList<E> extends AbstractList<E> implements List<E>, RandomAccess, Cloneable, java.io.Serializable { private static final long serialVersionUID = 8683452581122892189L;
public static void main(String[] args) { List<Integer> list = Arrays.asList(1, 2, 3, 4); // List<Integer> list = new ArrayList<>(Arrays.asList(1, 2, 3, 4)); // Java 9부터는 List.of() 사용 System.out.println(list.remove(1)); } Exception in thread "main" java.lang.UnsupportedOperationException at java.base/java.util.AbstractList.remove(AbstractList.java:167)
List<Integer> list = new ArrayList<>(Arrays.asList(1, 2, 3, 4)); List<Integer> list = List.of(1, 2, 3, 4);
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Arrays.asList
The text was updated successfully, but these errors were encountered: