Win a copy of Mesos in Action this week in the Cloud/Virtualizaton 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: 13061
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: 4567
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