aspose file tools*
The moose likes Java in General and the fly likes Empty ArrayList Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "Empty ArrayList" Watch "Empty ArrayList" New topic
Author

Empty ArrayList

Kaustubh G Sharma
Ranch Hand

Joined: May 13, 2010
Posts: 1281



No Kaustubh No Fun, Know Kaustubh Know Fun..
Christophe Verré
Sheriff

Joined: Nov 24, 2005
Posts: 14688
    
  16

but it is not even printing the string attached with it

new ArrayList(100) doesn't mean that the list has 100 items.
API wrote:public ArrayList(int initialCapacity)
Constructs an empty list with the specified initial capacity.


It doesn't enter the loop. Why would it print the message ?


[My Blog]
All roads lead to JavaRanch
David O'Meara
Rancher

Joined: Mar 06, 2001
Posts: 13459

This is an ArrayList, not an Array.
While you have defined the initial capacity, it is still empty until you put something in it.
The initial capacity is used for determining the supported size behind the scenes so that you can reduce the time spent resizing the data structure behind the scenes if you already know (or have a good idea of) the number of items going into the ArrayList
Kaustubh G Sharma
Ranch Hand

Joined: May 13, 2010
Posts: 1281

Got it ...Thanks Guys
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Empty ArrayList