[concurrency-interest] RE: Concurrency-interest Digest, Vol 9, Issue 14

Hu, Jinsong jhu at glog.com
Mon Oct 17 10:10:36 EDT 2005


Thanks.

I do care about get(), that's why I want to use hash index. What I am trying to do is using hash index and storing data elements in sorted order to achieve range query. 

All the DataElements of my DataBlock are sorted, the first time the DataBlock is loaded from disk, I will build up hash index for them, if a request for range query coming in, I first use hashing to find the correct element, then calling geNext() one by one to get the range result. I think a navigable LinkedHashMap is the answer.


-----Original Message-----
From: concurrency-interest-bounces at cs.oswego.edu [mailto:concurrency-interest-bounces at cs.oswego.edu] On Behalf Of concurrency-interest-request at cs.oswego.edu
Sent: Sunday, October 16, 2005 12:01 PM
To: concurrency-interest at altair.cs.oswego.edu
Subject: Concurrency-interest Digest, Vol 9, Issue 14

Send Concurrency-interest mailing list submissions to
	concurrency-interest at altair.cs.oswego.edu

To subscribe or unsubscribe via the World Wide Web, visit
	http://altair.cs.oswego.edu/mailman/listinfo/concurrency-interest
or, via email, send a message with subject or body 'help' to
	concurrency-interest-request at altair.cs.oswego.edu

You can reach the person managing the list at
	concurrency-interest-owner at altair.cs.oswego.edu

When replying, please edit your Subject line so it is more specific
than "Re: Contents of Concurrency-interest digest..."


Today's Topics:

   1. Re: About LinkedHashMap (R?mi Forax)


----------------------------------------------------------------------

Message: 1
Date: Sat, 15 Oct 2005 19:08:54 +0200
From: R?mi Forax <forax at univ-mlv.fr>
Subject: Re: [concurrency-interest] About LinkedHashMap
Cc: concurrency-interest at altair.cs.oswego.edu
Message-ID: <435137A6.5050308 at univ-mlv.fr>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed

Hu, Jinsong a écrit :
> I know this is an off-topic question to post here, but I did struggling
> to find the right way to use this class, and I know there are lot of
> experts in this mail list. I would appreciate it very much on this if
> you could throw some lights. 
> 
> Suppose I have a DataBlock which contains a list of DataElement, and I
> have a HashMap which basically acts a hash index to quickly identify the
> DataElement according to a given key. Now, if I get the element and I
> want to find the next element very quickly, but it seems to me that
> current Collection API does not provide a quick solution to this, it
> appears that I have to link the DataElement by myself to achieve this.
> LinkedHashMap seems a promising solution to this problem, but it does
> not provide a public method to get the entry, it only guarantees the
> order of insertion or access.
> 
> Any thought? 

Mustang introduces a new interface, NavigableMap, that permits
to find the previous or the next entry using
lowerEntry(K key) and higherEntry(K key).
(http://download.java.net/jdk6/doc/api/java/util/NavigableMap.html)

But LinkedHashMap doesn't implements NavigableMap :(
I have personnaly warn doug lea about this.
He said that the JSR166 commitee decide to make
NavigableMap a subclass of SortedMap so
because LinkedHashMap doesn't implements SortedMap, it couldn't
be retrofited to implements NavigableMap without breaking
programs already written.

Workaround : use a TreeMap instead of LinkedHashMap
even if it's the method get() have a log(n) complexity.

> 
> Thanks
> Jinsong
> 

Rémi Forax





------------------------------

_______________________________________________
Concurrency-interest mailing list
Concurrency-interest at altair.cs.oswego.edu
http://altair.cs.oswego.edu/mailman/listinfo/concurrency-interest


End of Concurrency-interest Digest, Vol 9, Issue 14
***************************************************



More information about the Concurrency-interest mailing list