• Post Reply Bookmark Topic Watch Topic
  • New Topic

Multidimensional ArrayList as used in a collection  RSS feed

 
Tony Braun
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all

I am a relative beginner to java and have a question regarding Array Lists.I have read many books in my efforts to learn java 8 but none of them can answer my question completely.

I am trying to store on a HDD information of strings using an arraylist but cannot see how to store a multidimensional array of strings of 6 columns  but over time steadily increasing rows.  Eventually I will need to store on the HDD a sort of database that can be cross referenced against another part of the program.

Is this possible with and array-list and if so what would be the correct syntax. Failing this can any one suggest an alternative that a beginner could handle.

Thanks in advance

 
Knute Snortum
Sheriff
Posts: 4281
127
Chrome Eclipse IDE Java Postgres Database VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Two things come to mind: one is that you can use an Object Output Stream to write an object to the disk, but if you want a "sort of database", why not use a simple database like SQLite?
 
Campbell Ritchie
Marshal
Posts: 56570
172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I worry when I see people using multiple arrays; you should be able to create some sort of class which has six fields for the Strings. You can make the objects immutable quite easily and also make your class implement Serializable. Remember Strings already implement Serializable.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!