aspose file tools
The moose likes Beginning Java and the fly likes Regarding collection. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of The Software Craftsman this week in the Agile forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Regarding collection." Watch "Regarding collection." New topic

Regarding collection.

Mani vannan
Ranch Hand

Joined: Aug 21, 2004
Posts: 185
1. In a collection class, usually we dont specify the no of objects intially. How is it getting allocated dynamically?

2. Is there anyway that one can alter an array's size without altering it declaration?

Jeff Albertson
Ranch Hand

Joined: Sep 16, 2005
Posts: 1780
1. That depends on the implementation. Compare ArrayList which implements
a List using an array, and LinkedList which implements a List using link

2. I think what you are really asking is if arrays can dynamically change
their length: no, they cannot.

There is no emoticon for what I am feeling!
Ernest Friedman-Hill
author and iconoclast

Joined: Jul 08, 2003
Posts: 24189

This is a nice beginner-level question, so let's move it to Java in General (Beginner).

[Jess in Action][AskingGoodQuestions]
I agree. Here's the link:
subject: Regarding collection.