This week's book giveaway is in the Design forum.
We're giving away four copies of Design for the Mind and have Victor S. Yocco on-line!
See this thread for details.
Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

ArrayList versus plain ol' String[]

 
Jason Barraclough
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hiya folks at the ranch.

I have a problem that is baffling me...



firstnameList is an ArrayList<String>() object.
The above serialised array firstNamesArray is read in from a file. It is 105735 elements in size. When I convert it to an ArrayList object, it mysteriously drops down to 87268 strings in the list.

Plenty of JVM memory left over... I can create as many ArrayList objects of this 87268 String capacity but can't seem to create more than that. I need to incorporate up to 1,555,000 Strings in the list.

Any ideas what might be going on here?
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13058
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Pretty mysterious alright.

Why are you sure the file contains 105735 String objects. What serialized that String[]?

Bill
 
Matthew Brown
Bartender
Posts: 4566
8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Just to add to what William said: have you printed out firstNamesArray.length in that code to confirm the length?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic