コード例 #1
0
  @Override
  public Boolean get(Object o) {
    if (!(o instanceof String)) return null;

    String key = (String) o;

    int hashcode = d_keys.number(key);
    if (hashcode == -1) return null;

    return d_values[hashcode - 1];
  }
コード例 #2
0
 /** Get an iterator over the keys in the mapping. */
 public Iterator<String> keyIterator() {
   return d_keys.iterator();
 }
コード例 #3
0
 @Override
 public int size() {
   return d_keys.size();
 }
コード例 #4
0
 @Override
 public boolean isEmpty() {
   return d_keys.isEmpty();
 }
コード例 #5
0
  /** Get the value associated with a key, returning a default value is it is not in the mapping. */
  public boolean getOrElse(String key, boolean defaultValue) {
    int hash = d_keys.number(key);
    if (hash == -1) return defaultValue;

    return d_values[hash - 1];
  }
コード例 #6
0
 @Override
 public boolean containsKey(Object o) {
   return d_keys.contains(o);
 }