Results 1 to 7 of 7
Thread: Multidimensional hashtable?
- 08-16-2008, 04:30 AM #1
Member
- Join Date
- Aug 2008
- Posts
- 15
- Rep Power
- 0
- 08-16-2008, 01:44 PM #2
Yes. There are many ways to store data. Can you describe your problem in more detail.
- 08-17-2008, 12:47 AM #3
Member
- Join Date
- Aug 2008
- Posts
- 15
- Rep Power
- 0
Mk perhaps I have an unknown number of people connecting to a server with a name, an age as an int and a socket connection. I want to store them all in something like an array or a hashtable so I can do a for each or an enumeration for them, but an array only holds one type of data and a hashtable only can store two things.
- 08-17-2008, 02:38 AM #4
How do you want to access the data? By key then a hash, by index then an array.
You can have an array of objects. An object can hold any combination of data.
- 08-17-2008, 05:02 AM #5
Member
- Join Date
- Aug 2008
- Posts
- 15
- Rep Power
- 0
How would I go about making a multidimensional array of objects?
object[][] arrayName = new object[3][10];
-
As Norm is suggesting, you really don't want to do this. You'll be far better off creating a class that holds your name String, age int, and any other pertinent objects, and then have a single dimensional array (or HashMap if need be) that holds objects of the new class's type.How would I go about making a multidimensional array of objects?
- 08-17-2008, 05:23 AM #7
Member
- Join Date
- Aug 2008
- Posts
- 15
- Rep Power
- 0
Similar Threads
-
Make Java codes more simplier (Multidimensional Arrays)
By javanewbie in forum JCreatorReplies: 9Last Post: 06-25-2008, 04:48 AM -
how can we get the element of by using the hashtable
By raj reddy in forum Web FrameworksReplies: 1Last Post: 05-06-2008, 01:45 PM -
Hashtable example
By Java Tip in forum Java TipReplies: 0Last Post: 02-15-2008, 08:43 AM -
Hashtable-put method
By new_1 in forum New To JavaReplies: 1Last Post: 12-23-2007, 07:07 PM -
Multidimensional arrays
By Java Tip in forum Java TipReplies: 0Last Post: 11-05-2007, 05:07 PM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks