How to remove a JDBMHashtable?

Eric Jain
2002-10-08
2002-10-11
  • Eric Jain

    Eric Jain - 2002-10-08

    Is there any way to efficiently remove all records associated with a particular JDBMHashtable without having to loop through all keys?

    In principal it would be great if there was a JDBMMap that implemented the java.util.Map interface. But even now, the interface is really nice and clear.

    One exception though is dispose(), what does it do?

     
    • Eric Jain

      Eric Jain - 2002-10-08

      In fact deleting while looping through all keys doesn't seem to work as hasMoreElements() apparently returns false if the underlying hashtable is modified...

       
    • Alex Boisvert

      Alex Boisvert - 2002-10-11

      Sorry.  There currently isn't any efficient way of removing all records in a JDBMHashtable.

      I'm taking note of this and will implement it in the near future.

      Same goes for providing a java.util.Map interface.  This has been suggested many times in the past.  I just have to get around to doing it. [If anybody wants to volunteer, please start from the current CVS version, not the 0.12 release]

      The second problem you mention about the enumeration returning false is a known limitation.  A quick workaround would be to enumerate all the keys first and then delete them one by one.

      alex

       

Log in to post a comment.