Ejemplo n.º 1
0
 /**
  * Get the value for {@var key}.
  *
  * @param key the key to look up
  * @param dft The value to return if the key is not in the vector
  * @return the value (or {@var dft} if the key is not set to a value)
  */
 public double get(long key, double dft) {
   final int idx = keys.getIndexIfActive(key);
   if (idx >= 0) {
     return values[idx];
   } else {
     return dft;
   }
 }
Ejemplo n.º 2
0
 /**
  * Get the value for {@var key}.
  *
  * @param key the key to look up; the key must be in the key set.
  * @return the key's value
  * @throws IllegalArgumentException if {@var key} is not in the key set.
  */
 public double get(long key) {
   final int idx = keys.getIndexIfActive(key);
   if (idx >= 0) {
     return values[idx];
   } else {
     throw new IllegalArgumentException("Key " + key + " is not in the key set");
   }
 }