>I expect that the linked map will be very, very fast.

I just wanted to confirm that what I think I know about the LinkedMap is 
correct.   I believe it should be using the map to do the indexOf(object) 
lookup and not iterating like Vector.indexOf(object).  But LinkedMap.java has 
it using this loop which makes me think it's slow relative to a hashmap lookup. 
 I'm looking for a collection like a Vector but with an indexOf(object) method 
which uses a map of object->index instead of iterating like a Vector does.

/**
* Gets the index of the specified key.
* 
* @param key  the key to find the index of
* @return the index, or -1 if not found
*/
    public int indexOf(Object key) {
        key = convertKey(key);
        int i = 0;
        for (LinkEntry entry = header.after; entry != header; entry = 
entry.after, i++) {
            if (isEqualKey(key, entry.key)) {
                return i;
            }
        }
        return -1;
    }


Thanks,
Andrew
 


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to