tag:blogger.com,1999:blog-29989659.post7965689122949669999..comments2022-11-25T07:59:11.259-05:00Comments on Rethinking the world... and making it a better place: literal arrays and lists in JavaRobert Jack Wildhttp://www.blogger.com/profile/08161002355215820551noreply@blogger.comBlogger5125tag:blogger.com,1999:blog-29989659.post-13960807069007085932017-11-28T05:38:29.920-05:002017-11-28T05:38:29.920-05:00Thanks, it was very useful!Thanks, it was very useful!Anonymoushttps://www.blogger.com/profile/10845420503150924884noreply@blogger.comtag:blogger.com,1999:blog-29989659.post-59723266300263895902016-02-18T02:10:52.939-05:002016-02-18T02:10:52.939-05:00This comment has been removed by a blog administrator.Anonymoushttps://www.blogger.com/profile/05365376754075819069noreply@blogger.comtag:blogger.com,1999:blog-29989659.post-57166129139805410782013-12-18T18:35:20.333-05:002013-12-18T18:35:20.333-05:00Although Arrays.asList(...) exists since 1998, var...Although Arrays.asList(...) exists since 1998, varargs only came much later. Also, Java does not have arrays of primitives - only arrays of Objects - and another thing that came later is autoboxing of literals into objects. So, at that time, you could not write:<br />Arrays.asList(1, 2)<br /><br />You would have had to write:<br />Arrays.asList( new Integer[ ] { new Integer(1), new Integer(2), new Integer(3) } )<br /><br />Yes, that is shorter than the multiple ls.add(...) statements but much harder for a Java beginner, the person for whom the tutorial was written.Ajoy Bhatiahttps://www.blogger.com/profile/17192656314049978826noreply@blogger.comtag:blogger.com,1999:blog-29989659.post-18763492898320890312012-05-23T07:09:55.685-04:002012-05-23T07:09:55.685-04:00I'm a bit late to the party, but I just though...I'm a bit late to the party, but I just thought I could point out that the reason why asList(T... a) is placed in Arrays is just because it takes an array. Java's variable length argument lists are nothing but syntactic sugar for an array.Henrikhttp://henko.netnoreply@blogger.comtag:blogger.com,1999:blog-29989659.post-28735660973726033612010-06-05T09:15:23.998-04:002010-06-05T09:15:23.998-04:00Also, there's collection litterals which shoul...Also, there's collection litterals which should make it into JDK7 (see the proposal at http://mail.openjdk.java.net/pipermail/coin-dev/2009-March/001193.html)Gilles Duboscqhttps://www.blogger.com/profile/02547913130397276632noreply@blogger.com