/** * Returns the value associated with the specified key. * It is often a good idea to first check with {@link #containsKey(double)} whether the given key has a value associated or not, i.e. whether there exists an association for the given key or not. * * @param key the key to be searched for. * @return the value associated with the specified key; <tt>0</tt> if no such key is present. */ public int get(double key) { int i = indexOfKey(key); if (i<0) return 0; //not contained return values[i]; } /**
/** * Returns <tt>true</tt> if the receiver contains the specified key. * * @return <tt>true</tt> if the receiver contains the specified key. */ public boolean containsKey(double key) { return indexOfKey(key) >= 0; } /**
/** * Returns <tt>true</tt> if the receiver contains the specified key. * * @return <tt>true</tt> if the receiver contains the specified key. */ public boolean containsKey(double key) { return indexOfKey(key) >= 0; } /**
/** * Returns <tt>true</tt> if the receiver contains the specified key. * * @return <tt>true</tt> if the receiver contains the specified key. */ public boolean containsKey(double key) { return indexOfKey(key) >= 0; }
/** * Returns the value associated with the specified key. * It is often a good idea to first check with {@link #containsKey(double)} whether the given key has a value associated or not, i.e. whether there exists an association for the given key or not. * * @param key the key to be searched for. * @return the value associated with the specified key; <tt>0</tt> if no such key is present. */ public int get(double key) { int i = indexOfKey(key); if (i<0) return 0; //not contained return values[i]; } /**
/** * Returns the value associated with the specified key. It is often a good * idea to first check with {@link #containsKey(double)} whether the given * key has a value associated or not, i.e. whether there exists an * association for the given key or not. * * @param key * the key to be searched for. * @return the value associated with the specified key; <tt>0</tt> if no * such key is present. */ public int get(double key) { int i = indexOfKey(key); if (i < 0) return 0; // not contained return values[i]; }
/** * Removes the given key with its associated element from the receiver, if present. * * @param key the key to be removed from the receiver. * @return <tt>true</tt> if the receiver contained the specified key, <tt>false</tt> otherwise. */ public boolean removeKey(double key) { int i = indexOfKey(key); if (i<0) return false; // key not contained this.state[i]=REMOVED; //this.values[i]=0; // delta this.distinct--; if (this.distinct < this.lowWaterMark) { int newCapacity = chooseShrinkCapacity(this.distinct,this.minLoadFactor, this.maxLoadFactor); /* if (table.length != newCapacity) { System.out.print("shrink rehashing "); System.out.println("at distinct="+distinct+", capacity="+table.length+" to newCapacity="+newCapacity+" ..."); } */ rehash(newCapacity); } return true; } /**
/** * Removes the given key with its associated element from the receiver, if present. * * @param key the key to be removed from the receiver. * @return <tt>true</tt> if the receiver contained the specified key, <tt>false</tt> otherwise. */ public boolean removeKey(double key) { int i = indexOfKey(key); if (i<0) return false; // key not contained this.state[i]=REMOVED; //this.values[i]=0; // delta this.distinct--; if (this.distinct < this.lowWaterMark) { int newCapacity = chooseShrinkCapacity(this.distinct,this.minLoadFactor, this.maxLoadFactor); /* if (table.length != newCapacity) { System.out.print("shrink rehashing "); System.out.println("at distinct="+distinct+", capacity="+table.length+" to newCapacity="+newCapacity+" ..."); } */ rehash(newCapacity); } return true; } /**
/** * Removes the given key with its associated element from the receiver, if * present. * * @param key * the key to be removed from the receiver. * @return <tt>true</tt> if the receiver contained the specified key, * <tt>false</tt> otherwise. */ public boolean removeKey(double key) { int i = indexOfKey(key); if (i < 0) return false; // key not contained this.state[i] = REMOVED; // this.values[i]=0; // delta this.distinct--; if (this.distinct < this.lowWaterMark) { int newCapacity = chooseShrinkCapacity(this.distinct, this.minLoadFactor, this.maxLoadFactor); /* * if (table.length != newCapacity) { * System.out.print("shrink rehashing "); * System.out.println("at distinct=" * +distinct+", capacity="+table.length * +" to newCapacity="+newCapacity+" ..."); } */ rehash(newCapacity); } return true; }