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? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
/** * 以正确的顺序(从第一个到最后一个元素)返回一个包含此列表中所有元素的数组。 * 返回的数组将是“安全的”,因为该列表不保留对它的引用。 (换句话说,这个方法必须分配一个新的数组)。 * 因此,调用者可以自由地修改返回的数组。 此方法充当基于阵列和基于集合的API之间的桥梁。 */ public Object[] toArray() { return Arrays.copyOf(elementData, size); }
The text was updated successfully, but these errors were encountered:
这样修改会不会更好一些:
/** * 以正确的顺序(从第一个到最后一个元素)返回一个包含此列表中所有元素的数组。 * 返回的数组将是“安全的”,因为该列表不保留对它的引用。 * (换句话说,这个方法必须分配一个新的数组)。 * 因此,调用者可以自由地修改返回的数组结构。 * 注意:如果元素是引用类型,修改元素的内容会影响到原列表中的对象。 * 此方法充当基于数组和基于集合的API之间的桥梁。 */ public Object[] toArray() { return Arrays.copyOf(elementData, size); }
Sorry, something went wrong.
No branches or pull requests
/** * 以正确的顺序(从第一个到最后一个元素)返回一个包含此列表中所有元素的数组。 * 返回的数组将是“安全的”,因为该列表不保留对它的引用。 (换句话说,这个方法必须分配一个新的数组)。 * 因此,调用者可以自由地修改返回的数组。 此方法充当基于阵列和基于集合的API之间的桥梁。 */ public Object[] toArray() { return Arrays.copyOf(elementData, size); }
The text was updated successfully, but these errors were encountered: