Hi Daniel,
that constructor pre-allocates storage so the backing
GrowableIndexedMemoryChunk will start off with the requested size. This is
helpful if you already have some idea of the maximum size of the ArrayList and
want to avoid repeatedly doubling the size of the backing store (with
associated cost of reallocation).
The size of the ArrayList will always be <= the size of the backing store.
Cheers,
Josh
Josh Milthorpe
Postdoctoral Fellow, Research School of Computer Science
Australian National University, Building 108
Canberra, ACT 0200
Australia
Phone: + 61 (0)2 61254478
Mobile: + 61 (0)407 940743
E-mail: [email protected]
Web: http://cs.anu.edu.au/~Josh.Milthorpe/
-------- Original message --------
From: Daniel Alexander Perlmutter <[email protected]>
Date:
To: Mailing list for users of the X10 programming language
<[email protected]>
Subject: [X10-users] X10 ArrayList constructor?
Can anyone explain how the second constructor for ArrayList that takes a size
paramter works? I assumed it would create an ArrayList and populate it with
some default value but it appear that if you construct an ArrayList with for
example "temp = new ArrayList(10)" and then check "temp.size()" you get 0. Why
is this, and what is the purpose of this constructor?
------------------------------------------------------------------------------
Precog is a next-generation analytics platform capable of advanced
analytics on semi-structured data. The platform includes APIs for building
apps and a phenomenal toolset for data science. Developers can use
our toolset for easy data analysis & visualization. Get a free account!
http://www2.precog.com/precogplatform/slashdotnewsletter
_______________________________________________
X10-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/x10-users