KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
public ArrayList(Collection<? extends E> c) { elementData = c.toArray(); size = elementData.length; // c.toArray might (incorrectly) not return Object[] (see 6260652) if (elementData.getClass() != Object[].class) elementData = Arrays.copyOf(elementData, size, Object[].class); } the code is the construction of java.util.ArrayList. you can check the details of bug 6260652, here https://bugs.java.com/bugdatabase/view_bug?bug_id=6260652 my question is if I don't convert the type, what problem will happen? Because I think it's totally OK if elementData refer to subType array.
Tags (comma-separated)
Save Edits
Cancel