• 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Tim Cooke
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Knute Snortum
  • paul wheaton
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Ron McLeod
  • Piet Souris
  • Ganesh Patekar
Bartenders:
  • Tim Holloway
  • Carey Brown
  • salvin francis

Multidimensional ArrayList as used in a collection

 
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

 
Sheriff
Posts: 6167
163
Eclipse IDE Postgres Database VI Editor Chrome Java Ubuntu
  • 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?
 
Marshal
Posts: 65383
248
  • 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.
 
You don't like waffles? Well, do you like this tiny ad?
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!