Skip to content
New issue

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

VJTools#Rule 12:Array转换List的问题 #53

Closed
fly-china opened this issue Jul 6, 2018 · 0 comments
Closed

VJTools#Rule 12:Array转换List的问题 #53

fly-china opened this issue Jul 6, 2018 · 0 comments

Comments

@fly-china
Copy link

Rule 12. 【推荐】Array 与 List互转的正确写法
两种Array转换List,错误和正确的代码范例:
// array -> list List list = Arrays.asList(array); //WRONG List list = new ArrayList(array); //RIGHT

其中正确的方式:List list = new ArrayList(array)
ArrayList的构造函数有三种:无参数、一个参数:容量、一个参数:Collection<? extends E>
没有可供直接传数组的构造方法

calvin1978 added a commit that referenced this issue Jul 6, 2018
calvin1978 added a commit that referenced this issue Jul 6, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants