Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!gegeweb.org!de-l.enfer-du-nord.net!feeder1.enfer-du-nord.net!texta.sil.at!newscore.univie.ac.at!aconews-feed.univie.ac.at!aconews.univie.ac.at!not-for-mail Newsgroups: comp.lang.java.programmer From: Andreas Leitgeb Subject: Re: setSize ArrayList, when will it come? References: <9aetckFmvmU1@mid.individual.net> <9aftbqFa9kU1@mid.individual.net> Reply-To: avl@logic.at User-Agent: slrn/pre0.9.9-111 (Linux) Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-ID: Date: 12 Aug 2011 15:06:39 GMT Lines: 19 NNTP-Posting-Host: gamma.logic.tuwien.ac.at X-Trace: 1313161599 tunews.univie.ac.at 71616 128.130.175.3 X-Complaints-To: abuse@tuwien.ac.at Xref: x330-a1.tempe.blueboxinc.net comp.lang.java.programmer:7043 Jan Burse wrote: > Andreas Leitgeb schrieb: >> In*that* case, I'd use a plain array, sized to say 2048 and >> just index into it. > But I guess the fixed size assumption is not possible > here. The array might or might not filled at all. Is that now about an odd chance that the array/ArrayList might grow beyond the initial estimate? Or is that about other code (that sees the ArrayList) that may be relying on that the last non-null element is at position "size()-1" ? If the former: for an odd-chance event, doing addAll(...nCopies(...)) is good enough. If the latter: stick to Vector ;-/ Even if ArrayList.setSize() was ever added, that would surely happen too late for your project.