It appears you have not yet registered with DEVPPL. To register please click here... (it's fast, easy and free!)

Forum

Log In Sponsors
Partner Sites
Board index Programming Java Forum

small collections VS large arrays

small collections VS large arrays

Postby fipi on Wed Jun 20, 2007 9:46 pm

Hi, I was just wondering if in some cases collections can use less memory than arrays. Collections (like an ArrayList) are simply objects linked to each other with no maximum size, right? But arrays allocate memory for their contents when they are created, right? (Correct me if I'm wrong, please.) So, for example, would an ArrayList with 50 objects use less memory than an array with a length of 1000 but only containing 50 objects?
(\__/)
(='.'=)
(")_(")
This is bunny. Help bunny gain world domination by copying him into your signature.

"Efficiency is intelligent laziness." ~David Dunham
fipi
 
Posts: 3
Joined: Thu May 03, 2007 7:07 pm
Location: TX, USA

Return to Java Forum

Who is online

Users browsing this forum: No registered users and 0 guests