Code Comments

Programming Forum and web based access to our favorite programming groups.
For Programmers: Free Programming Magazines | New: Database administration forum
Registration is free! Edit your profileCalendarFind other membersFrequently Asked QuestionsSearch -> 
Post New Thread











Thread
Author

Two dimensional hash
Dear all,

Anyone knows an easy way to use a two dimensional hash in Java? For
example, in Perl, it can be used like $foo{$bar1}{$bar2}.

Thanks!

Report this thread to moderator Post Follow-up to this message
Old Post
Hongyu Zhang
10-29-04 01:57 AM


Re: Two dimensional hash
Hongyu Zhang wrote:

> Dear all,
>
> Anyone knows an easy way to use a two dimensional hash in Java? For
> example, in Perl, it can be used like $foo{$bar1}{$bar2}.
>
> Thanks!

What exactly are you trying to store, and how do you intend to access it?

For starters, you may be interested in reading about multi-dimensional
arrays:

http://java.sun.com/docs/books/tuto...ultiarrays.html

You should also read up on collections here:

http://java.sun.com/docs/books/tutorial/collections/

HTH,
Carl.

Report this thread to moderator Post Follow-up to this message
Old Post
Carl
10-29-04 01:57 AM


Re: Two dimensional hash
Hongyu Zhang wrote:
> Dear all,
>
> Anyone knows an easy way to use a two dimensional hash in Java?

Yes, the obvious ones:

* Use Maps of Maps - inefficient

or

* Combine the two keys into one object, using that as a key in a Map.
Which is the way multidimensional hashs are usually implemented.

/Thomas

Report this thread to moderator Post Follow-up to this message
Old Post
Thomas Weidenfeller
10-29-04 01:57 PM


Re: Two dimensional hash
Both methods that you suggested are good enough for me. Thanks very much, Th
omas!

Thomas Weidenfeller <nobody@ericsson.invalid> wrote in message news:<clsstv$3q6$1@newstree.
wise.edt.ericsson.se>...
> Hongyu Zhang wrote: 
>
> Yes, the obvious ones:
>
> * Use Maps of Maps - inefficient
>
> or
>
> * Combine the two keys into one object, using that as a key in a Map.
> Which is the way multidimensional hashs are usually implemented.
>
> /Thomas

Report this thread to moderator Post Follow-up to this message
Old Post
Hongyu Zhang
10-30-04 01:57 AM


Sponsored Links




Last Thread Next Thread Next
Search this forum -> 
Post New Thread

Java Help archive

Show a Printable Version Send to friend Email This Page to Someone! subscribe to this thread Receive updates to this thread
Computer Consultants
Programming Jobs
Visual Basic Controls
SQL Server Programming
Webservices
Java Security
Visual Studio
C# Programming
Visual J++
Software engineering
Open source Software
Perl Programming
PHP Programming
ASP Programming
ASP .NET Programming
Visual Basic Programming
Windows Scripting Host
Java Programming
Java Help
Java Beans
VBScript
Cobol
MAC Applications
Unix Programming
Forum Jump:
All times are GMT. The time now is 05:11 AM.

 
Free MCSE Braindumps | Real Estate Topics

Programming forum archive

Copyrights CodeComments.com 2004 - 2006

Powered by vBulletin Copyright 2000-2006 Jelsoft Enterprises Limited.