RE: Concurrency-interest Digest, Vol 9, Issue 14

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

RE: Concurrency-interest Digest, Vol 9, Issue 14

Hu, Jinsong
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: [hidden email] [mailto:[hidden email]] On Behalf Of [hidden email]
Sent: Sunday, October 16, 2005 12:01 PM
To: [hidden email]
Subject: Concurrency-interest Digest, Vol 9, Issue 14

Send Concurrency-interest mailing list submissions to
        [hidden email]

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
        [hidden email]

You can reach the person managing the list at
        [hidden email]

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 <[hidden email]>
Subject: Re: [concurrency-interest] About LinkedHashMap
Cc: [hidden email]
Message-ID: <[hidden email]>
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
[hidden email]
http://altair.cs.oswego.edu/mailman/listinfo/concurrency-interest


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

_______________________________________________
Concurrency-interest mailing list
[hidden email]
http://altair.cs.oswego.edu/mailman/listinfo/concurrency-interest
Reply | Threaded
Open this post in threaded view
|

Re: RE: Concurrency-interest Digest, Vol 9, Issue 14

Doug Lea
Hu, Jinsong wrote:
>  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.
>

See rfe 6266354 http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6266354
which is probably also what you want.

This won't be in Mustang, but you can vote for it for Dolphin :-)

-Doug


_______________________________________________
Concurrency-interest mailing list
[hidden email]
http://altair.cs.oswego.edu/mailman/listinfo/concurrency-interest
Reply | Threaded
Open this post in threaded view
|

Re: RE: Concurrency-interest Digest, Vol 9, Issue 14

Remi Forax
Doug Lea wrote:

> Hu, Jinsong wrote:
>
>>  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.
>>
>
> See rfe 6266354
> http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6266354
> which is probably also what you want.

My to cents, at least that 6182958 and 4848853 are related too.

>
> This won't be in Mustang, but you can vote for it for Dolphin :-)
>
> -Doug
>
Rémi Forax

_______________________________________________
Concurrency-interest mailing list
[hidden email]
http://altair.cs.oswego.edu/mailman/listinfo/concurrency-interest