【Java编程思想第4版错误记录】Collections.addAll()静态方法与Collection.addAll()成员方法

来源:互联网 发布:unity3d遮罩shader 编辑:程序博客网 时间:2024/06/06 01:05

最近读Java编程思想的时候发现一些错误,抱着前辈们已经发现了这些错误,并将其总结在网上的想法,本人便在网上进行搜寻。

果不其然,功夫不负有心人,我在CSDN上找到了白爽前辈总结的《Java编程思想4全部勘误》。其中所列举的错误,很多都是我在之前阅读的过程中没有注意到的,不得不佩服前辈的一丝不苟!此勘误对我们这些晚辈帮助甚多!在此向白爽前辈表示感谢与崇高的敬意!

在这里,我补充一个我目前发现遗漏的错误:

P220页 11.3 第二段

原文:但是,Collection.addAll()方法运行起来要快得多,……

正确:但是,Collections.addAll()方法运行起来要快得多,……

英文原版为:

The constructor for a Collection can accept another Collection which it uses for initializing itself, so you can use Arrays.asList( ) to produce input for the constructor. However,Collections.addAll( ) runs much faster, and it’s just as easy to construct the Collection with no elements and then call Collections.addAll( ), so this is the preferred approach.

2 0
原创粉丝点击