• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Liutauras Vilda
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Saloon Keepers:
  • Scott Selikoff
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
  • Frits Walraven
Bartenders:
  • Stephan van Hulst
  • Carey Brown

Multidimensional ArrayList as used in a collection

 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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

 
Sheriff
Posts: 7126
185
Eclipse IDE Postgres Database VI Editor Chrome Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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?
 
Marshal
Posts: 80123
416
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
The City calls upon her steadfast protectors. Now for a tiny ad:
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
    Bookmark Topic Watch Topic
  • New Topic