Win a copy of Java Database Connections & Transactions (e-book only) this week in the JDBC forum!
  • 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
  • Devaka Cooray
  • Knute Snortum
  • Paul Clapham
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Bear Bibeault
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Ron McLeod
  • Piet Souris
  • Frits Walraven
Bartenders:
  • Ganesh Patekar
  • Tim Holloway
  • salvin francis

Multidimensional ArrayList as used in a collection  RSS feed

 
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

 
Marshal
Posts: 5995
156
Chrome Eclipse IDE Java Postgres Database Ubuntu 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?
 
Marshal
Posts: 64494
225
  • 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.
 
A wop bop a lu bop a womp bam boom! Tiny ad:
how do I do my own kindle-like thing - without amazon
https://coderanch.com/t/711421/engineering/kindle-amazon
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!