Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.programmer > #10137

Re: Size of an arraylist in bytes

From Lew <lewbloch@gmail.com>
Newsgroups comp.lang.java.programmer
Subject Re: Size of an arraylist in bytes
Date 2011-11-20 20:44 -0800
Organization http://groups.google.com
Message-ID <9477543.159.1321850670195.JavaMail.geo-discussion-forums@prmf13> (permalink)
References <e9dcfb2d-dfef-4ae6-9d9f-979a8f08b962@t36g2000prt.googlegroups.com> <jabri2$763$1@dont-email.me> <pointers-20111120224359@ram.dialup.fu-berlin.de> <jabt6a$i3u$1@dont-email.me>

Show all headers | View raw


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 »a rough analogy«:
>>
>>        »(...) reference values (...) are pointers«
> 
>      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 make?  A pointer is a pointer still, if it but points, though you cannot increment it.

No one is claiming that they're "C-style" pointers. so we'll throw that red herring back in the water.

-- 
Lew

Back to comp.lang.java.programmer | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Size of an arraylist in bytes sara <sarasara82@gmail.com> - 2011-11-20 13:01 -0800
  Re: Size of an arraylist in bytes markspace <-@.> - 2011-11-20 13:05 -0800
    Re: Size of an arraylist in bytes sara <sarasara82@gmail.com> - 2011-11-20 13:11 -0800
      Re: Size of an arraylist in bytes Andreas Leitgeb <avl@gamma.logic.tuwien.ac.at> - 2011-11-20 21:58 +0000
      Re: Size of an arraylist in bytes markspace <-@.> - 2011-11-20 14:08 -0800
      Re: Size of an arraylist in bytes Patricia Shanahan <pats@acm.org> - 2011-11-20 14:50 -0800
      Re: Size of an arraylist in bytes Arne Vajhøj <arne@vajhoej.dk> - 2011-11-20 18:06 -0500
      Re: Size of an arraylist in bytes Lew <lewbloch@gmail.com> - 2011-11-20 20:28 -0800
  Re: Size of an arraylist in bytes Eric Sosman <esosman@ieee-dot-org.invalid> - 2011-11-20 16:30 -0500
    Re: Size of an arraylist in bytes sara <sarasara82@gmail.com> - 2011-11-20 13:35 -0800
      Re: Size of an arraylist in bytes Eric Sosman <esosman@ieee-dot-org.invalid> - 2011-11-20 17:19 -0500
    Re: Size of an arraylist in bytes Eric Sosman <esosman@ieee-dot-org.invalid> - 2011-11-20 16:58 -0500
      Re: Size of an arraylist in bytes Patricia Shanahan <pats@acm.org> - 2011-11-20 14:04 -0800
        Re: Size of an arraylist in bytes Arne Vajhøj <arne@vajhoej.dk> - 2011-11-20 17:18 -0500
          Re: Size of an arraylist in bytes Patricia Shanahan <pats@acm.org> - 2011-11-20 14:48 -0800
            Re: Size of an arraylist in bytes Arne Vajhøj <arne@vajhoej.dk> - 2011-11-25 22:12 -0500
      Re: Size of an arraylist in bytes Lew <lewbloch@gmail.com> - 2011-11-20 20:44 -0800
        Re: Size of an arraylist in bytes Arne Vajhøj <arne@vajhoej.dk> - 2011-11-25 22:16 -0500
          Re: Size of an arraylist in bytes Lew <lewbloch@gmail.com> - 2011-11-25 20:15 -0800
  Re: Size of an arraylist in bytes Roedy Green <see_website@mindprod.com.invalid> - 2011-11-20 22:25 -0800
    Re: Size of an arraylist in bytes Arne Vajhøj <arne@vajhoej.dk> - 2011-11-25 22:11 -0500

csiph-web