in reply to •Re: Maintaing the insertion order of an N-tier hash
in thread Maintaing the insertion order of an N-tier hash
Of course, maintaining that structure could be a chore. Java has what you're looking for - a hash that maintains order - it's called a LinkedHashMap. Basically it's a hash with a linked list running through it. <handwaving>I leave the Perl implementation as an exercise for the reader...</handwaving>$VAR1 = { 'order' => [ 'Foo' ], 'data' => { 'Foo' => { 'order' => [ 'D', 'A', 'E', 'B', 'C' ], 'data' => { 'D' => { 'order' => [ '1' ], 'data' => { '1' => {} }, 'A' => {}, 'E' => { 'order' => [ '1', '2', '3', '4' ], 'data' => { '1' => {}, '2' => {}, '3' => {}, '4' => {} } } ...etc.
|
|---|