Path: csiph.com!x330-a1.tempe.blueboxinc.net!newsfeed.hal-mli.net!feeder3.hal-mli.net!nx02.iad01.newshosting.com!newshosting.com!69.16.185.21.MISMATCH!npeer03.iad.highwinds-media.com!news.highwinds-media.com!feed-me.highwinds-media.com!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail From: Lew Newsgroups: comp.lang.java.programmer Subject: Re: Bulk Array Element Allocation, is it faster? Date: Sun, 25 Sep 2011 11:02:12 -0700 (PDT) Organization: http://groups.google.com Lines: 23 Message-ID: <13107318.1206.1316973732647.JavaMail.geo-discussion-forums@prfp37> References: <9e8fplF19bU1@mid.individual.net> <9e8kdhF6lmU1@mid.individual.net> Reply-To: comp.lang.java.programmer@googlegroups.com NNTP-Posting-Host: 216.239.45.130 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Trace: posting.google.com 1316973831 16293 127.0.0.1 (25 Sep 2011 18:03:51 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Sun, 25 Sep 2011 18:03:51 +0000 (UTC) In-Reply-To: Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=216.239.45.130; posting-account=CP-lKQoAAAAGtB5diOuGlDQk0jIwmH0T User-Agent: G2/1.0 X-Google-Web-Client: true Xref: x330-a1.tempe.blueboxinc.net comp.lang.java.programmer:8301 Jan Burse wrote: > Actually this loop is something that shocked me > when I started working with Java many years ago. > What there is no way to make a "new" of an array > with all its elements? >=20 > This is not seen if one works with int[] or > double[] arrays. But as soon as you work with some > other array, either a higher dimensional of int[] > or double[] or an array of some class X. You are > responsible for populating the elements. This is equally true of primitive arrays. Why do you claim otherwise? The JLS, =A715.10.1, states, "... if a single DimExpr appears, a single-dim= ensional array is created of the specified length, and each component of th= e array is initialized to its default value (=A74.12.5)." This is true whe= ther the array is of a primitive or reference type. In either case, you are responsible for populating any non-default values. --=20 Lew