Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!gegeweb.42!gegeweb.eu!nntpfeed.proxad.net!proxad.net!feeder1-2.proxad.net!74.125.46.80.MISMATCH!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail From: Lew Newsgroups: comp.lang.java.programmer Subject: Re: Size of an arraylist in bytes Date: Sun, 20 Nov 2011 20:44:30 -0800 (PST) Organization: http://groups.google.com Lines: 50 Message-ID: <9477543.159.1321850670195.JavaMail.geo-discussion-forums@prmf13> References: Reply-To: comp.lang.java.programmer@googlegroups.com NNTP-Posting-Host: 173.164.137.214 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Trace: posting.google.com 1321850752 5446 127.0.0.1 (21 Nov 2011 04:45:52 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Mon, 21 Nov 2011 04:45:52 +0000 (UTC) In-Reply-To: Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=173.164.137.214; posting-account=CP-lKQoAAAAGtB5diOuGlDQk0jIwmH0T User-Agent: G2/1.0 X-Google-Web-Client: true Xref: x330-a1.tempe.blueboxinc.net comp.lang.java.programmer:10137 Eric Sosman wrote: > Stefan Ram wrote: >> Eric Sosman writes: >>> If you're coming from a C background, a rough analogy is that >>> the ArrayList holds "pointers" to the objects it holds, not copies >>> of those objects. >> >> An ArrayList /does/ hold pointers (in the sense of Java), >> this is not just =BBa rough analogy=AB: >> >> =BB(...) reference values (...) are pointers=AB >=20 > They're "pointers" in Java's terms, but Java is considerably They're "pointers" in programming terms, not just Java's. > more restrictive about what you can do with a "pointer" than C is. So? > You cannot, for example, print the value of a Java reference; you > can do so in C. You cannot convert a Java reference to or from an > integer; C allows it (with traps for the unwary). Java references > obey a type hierarchy; C's types (and hence the pointers to them) > are unrelated. And so on, and so on: Little niggly differences. > Since Java's references support (and prohibit) a different set of > operations than C's pointers do, I maintain they're as similar as > dogs and wolves, and as different. Dogs and wolves are the same species. They can interbreed. Java pointers *are* pointers - and that's all they are. They don't pretend= to do arithmetic on themselves. That does not make them less a pointer. The essence of pointers is that they point. The implicit 'const' on them (= in C terms) doesn't change that a jot. > Put it this way: If I had told sara "An ArrayList contains > C-style pointers to the objects it holds," would I have been > telling the truth? Why would you say such a bone-headed thing, and what difference does it mak= e? A pointer is a pointer still, if it but points, though you cannot incre= ment it. No one is claiming that they're "C-style" pointers. so we'll throw that red= herring back in the water. --=20 Lew