Multi-layered Hash in Java -



Multi-layered Hash in Java -

in perl if want have multi-layered hash, write:

$hash_ref->{'key1'}->{'key2'}='value';

where 'key1' might person's name, 'key2' might "savings account" (vs. "checking account") , 'value' might amount of money in account.

is there equivalent in java, i.e. access values via hash references? what's syntax this? examples or other resource references appreciated. thanks!

you can have map<map<..>>, you'll able phone call map.get("key1").get("key2")

but note java statically-typed, object-oriented language. you'd improve creat classes: person, savingsaccount, , person has field private savingsaccount savingsacount. you'll able compile-time safe: map.get("john").getsavingsaccount()

java hash reference multi-level multi-layer

Comments

Popular posts from this blog

How do I check if an insert was successful with MySQLdb in Python? -

delphi - blogger via idHTTP : error 400 bad request -

postgresql - ERROR: operator is not unique: unknown + unknown -