commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jack, Paul" <pj...@sfaf.org>
Subject RE: [Collections][SUBMIT] ReferenceMap...take 3...
Date Fri, 19 Jul 2002 23:45:43 GMT
I'm a big fan of Knuth's, but I don't actually have any of the
books mentioned on my shelves.  I'll probably go get the Intro
to Algorithms one.  I actually went out and bought _Effective
Java_ because Stephen Coulbourne kept invoking it...I never
realized membership on this list would be so expensive!

Meanwhile, I'm wondering if it's worth allowing users to 
specify their own hash functions:

public interface HashFunction {

    int translateHashCode(int hashCode);


    HashFunction DEFAULT = new HashFunction() {
        public int translateHashCode(int hash) {
            return hash * -127;
        }
    };

    HashFunction IDEAL = new HashFunction() {
        public int translateHashCode(int hash) {
            return (somePrime - 2 - hash) % (somePrime - 2);
        }
    };
}

Then SequencedHashMap and ReferenceMap could allow users to specify
a HashFunction in their constructors. 

Thoughts?

-Paul




> -----Original Message-----
> From: Juozas Baliuka [mailto:baliuka@centras.lt]
> Sent: Friday, July 19, 2002 2:55 PM
> To: Jakarta Commons Developers List
> Subject: Re: [Collections][SUBMIT] ReferenceMap...take 3...
> 
> 
> Books by Don Knuth are very good, but I don't have them at home
> http://www-cs-faculty.stanford.edu/~knuth/gk.html
> 
> 
> > On Fri, 19 Jul 2002, Jack, Paul wrote:
> > > Hm.  I couldn't really find my way around the above page. 
>  It definitely
> > > has a lot of good stuff but it's organized chronologically, so I
> couldn't
> > > find specific things related to hash functions... I'll 
> keep looking.
> >
> > My Intro to Algorithms book lists a "Multiplication Method" 
> that should
> > work well.  Don't have the book with me at the moment, but 
> I'll try to
> > summarize tonight...
> >
> > btw, if you don't own it already, I highly recommend the book:
> > http://www.amazon.com/exec/obidos/ASIN/0262032937
> >
> > regards,
> > michael
> >
> >
> >
> >
> > --
> > To unsubscribe, e-mail:
> <mailto:commons-dev-unsubscribe@jakarta.apache.org>
> > For additional commands, e-mail:
> <mailto:commons-dev-help@jakarta.apache.org>
> >
> 
> 
> --
> To unsubscribe, e-mail:   
<mailto:commons-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail:
<mailto:commons-dev-help@jakarta.apache.org>

--
To unsubscribe, e-mail:   <mailto:commons-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:commons-dev-help@jakarta.apache.org>


Mime
View raw message