• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

is there any table like data structure in java ?

 
Ranch Hand
Posts: 551
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi
thank you for reading my post
I am looking for a table like (rows and columns) data structure in java
does standard java has such thing or we should use some 3rd party libraries.

something lik :

columnA ColumnB ...
aaa dddd ...
bbb eeee ...
ccc gggg ...
 
Ranch Hand
Posts: 118
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If you are looking for a visualization of a table, consider using a JTable. If you are looking for only a data sturcture, you can just make a 2-d array:

int[][] myTable = new int[5][5];

This would give you a table of all integers with 5 rows and 5 columns. You could do this with any data type, not just ints.

Jeff
 
Sheriff
Posts: 9109
12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
HashMap
Hashtable

I guess it depends on what you're trying to do.
 
Java Cowboy
Posts: 16084
88
Android Scala IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
HashMap and Hashtable are dictionary data structures; I don't think that is what Raminaa is looking for.

There is no general purpose data structure in the standard Java API for a table-like data structure with columns and rows. However, you could use class javax.swing.table.DefaultTableModel. It's a Swing class but that doesn't mean you can only use it in programs with a Swing user interface.
reply
    Bookmark Topic Watch Topic
  • New Topic