nested hashtables


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 2 of 2

Thread: nested hashtables

  1. #1
    Lori Piquet Guest

    nested hashtables


    How often do you use nested hashtables in Java? Do you find their convenience
    worth the trade-off in complexity, or do you try to avoid them altogether?


    Lori Piquet
    DevX

  2. #2
    Vlad Patryshev Guest

    Re: nested hashtables


    "Lori Piquet" <piquet@devx.com> wrote:
    >
    >How often do you use nested hashtables in Java? Do you find their convenience
    >worth the trade-off in complexity, or do you try to avoid them altogether?
    >


    It happens all the time if you port to Java the Perl model of universe -
    hashes consisting of arrays of hashes etc.

    Say, a typical Perl expression would look like

    $myData->{keyLevelOne}[3]{keyLevel2}{keyLevel3};

    So, if we handle this with pleasure in Perl, it makes sense to do the same
    in Java.

    I would also add that the idea of writing

    String value = (String)((HashTable)(myHashTable.get("masterKey")).get("slaveKey");

    is not good at all - if myHashTable doe snot have "masterKey", all we get
    is a null-pointer exception. Having NotatedHashTable handle this issue would
    be just great.

    Also, a good example is an imported XML structure, where one will want to
    navigate all the time.

    But then, does not it imply that actually, instead of introducing a version
    of XPath search, maybe reduced for the reduced case of hashes of arrays of
    hashes?

    Still, even in this "Notated Hash" version, the idea is very good

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center