uk.ac.ebi.intact.util
Class Key
java.lang.Object
|
+--uk.ac.ebi.intact.util.Key
- public class Key
- extends java.lang.Object
This class provides a wrapper around a String object
for use with java Maps. The String class is inefficient
for direct use as a Map key, since it computes its hashcode every time
the Map is accessed. The Key caches it instead
to improve searching performance with Maps.
- Author:
- Chris Lewington
|
Constructor Summary |
Key(java.lang.String key)
|
|
Method Summary |
boolean |
equals(java.lang.Object obj)
|
java.lang.String |
getKey()
|
int |
hashCode()
returns a cached value, rather than re-computing for every call |
void |
setKey(java.lang.String key)
|
| Methods inherited from class java.lang.Object |
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait |
Key
public Key(java.lang.String key)
setKey
public void setKey(java.lang.String key)
getKey
public java.lang.String getKey()
hashCode
public int hashCode()
- returns a cached value, rather than re-computing for every call
- Overrides:
hashCode in class java.lang.Object
- Returns:
- int the cached hash code
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equals in class java.lang.Object
IntAct Project - EMBL-EBI 2004 - intact-help@ebi.ac.uk