Article View: borland.public.jbuilder.java.language
Article #18846arrays of objects
From: Kevin B
Date: Wed, 08 Apr 1998 00:00
Date: Wed, 08 Apr 1998 00:00
31 lines
1536 bytes
1536 bytes
Hi, I'm a C++/Delphi programmer that is fairly new to Java and I'm trying to makes some sense of something that is easy in either of these languages but not so intuitive in Java (to me). I'd like to be able to create a couple arrays of objects in Java and I'd like to preallocate the arrays so that I don't have the performance problem of creating each object separately. This is no problem as I can just do something like... MyObjectType myObjects[] = new MyObjectType[ 10000 ]; But what I'd like to do is create another array that will only hold a subset of the elements from this array. Since the object that makes up each element of this array is fairly large, I'd like for the elements of the second array to just be able to POINT at the actual objecs of the first array. This is easy in C++ or Delphi as I can just make the second array be an array of pointers (of type MyObjectType) and do something like myObjects2[i] = &myObjects[j]; But since there are no pointers in Java I'm confused as to how to do this or whether this is even possible. Can somebody straigten me out on this? TIA!! Kevin
Technical Details
Message-ID:
<01bd62ec$0c857a40$b2c33081@boylankl>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailShow Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f74b3,d90257f1ce51c897,start X-Google-Attributes: gidf74b3,public From: "Kevin B" <boylank@computer.org> Subject: arrays of objects Date: 1998/04/08 Message-ID: <01bd62ec$0c857a40$b2c33081@boylankl> X-Deja-AN: 342045308 Organization: Another Netscape Collabra Server User Newsgroups: borland.public.jbuilder.java.language