/** {@inheritDoc} */ public boolean containsAll( Collection<?> collection ) { for ( Object element : collection ) { if ( element instanceof Long ) { long ele = ( ( Long ) element ).longValue(); if ( ! TLongDoubleHashMap.this.containsKey( ele ) ) { return false; } } else { return false; } } return true; }
/** {@inheritDoc} */ public void putAll( Map<? extends Long, ? extends Double> map ) { ensureCapacity( map.size() ); // could optimize this for cases when map instanceof THashMap for ( Map.Entry<? extends Long, ? extends Double> entry : map.entrySet() ) { this.put( entry.getKey().longValue(), entry.getValue().doubleValue() ); } }
/** {@inheritDoc} */ public boolean increment( long key ) { return adjustValue( key, ( double ) 1 ); }
/** {@inheritDoc} */ public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException { // VERSION in.readByte(); // SUPER super.readExternal( in ); // NUMBER OF ENTRIES int size = in.readInt(); setUp( size ); // ENTRIES while (size-- > 0) { long key = in.readLong(); double val = in.readDouble(); put(key, val); } } } // TLongDoubleHashMap
/** {@inheritDoc} */ public boolean containsAll( double[] array ) { for ( double element : array ) { if ( ! TLongDoubleHashMap.this.containsValue( element ) ) { return false; } } return true; }
/** {@inheritDoc} */ public boolean contains( long entry ) { return TLongDoubleHashMap.this.contains( entry ); }
if (!cachedRelatedness.containsKey(key)) { relatedness = comparer.getRelatedness(art1, art2) ; cachedRelatedness.put(key, relatedness) ; relatedness = cachedRelatedness.get(key) ;
/** {@inheritDoc} */ public void clear() { TLongDoubleHashMap.this.clear(); }
/** * Creates a new <code>TLongDoubleHashMap</code> instance containing * all of the entries in the map passed in. * * @param keys a <tt>long</tt> array containing the keys for the matching values. * @param values a <tt>double</tt> array containing the values. */ public TLongDoubleHashMap( long[] keys, double[] values ) { super( Math.max( keys.length, values.length ) ); int size = Math.min( keys.length, values.length ); for ( int i = 0; i < size; i++ ) { this.put( keys[i], values[i] ); } }
/** {@inheritDoc} */ public boolean forEachKey( TLongProcedure procedure ) { return forEach( procedure ); }
/** {@inheritDoc} */ @Override public String toString() { final StringBuilder buf = new StringBuilder( "{" ); forEachEntry( new TLongDoubleProcedure() { private boolean first = true; public boolean execute( long key, double value ) { if ( first ) first = false; else buf.append( ", " ); buf.append(key); buf.append("="); buf.append(value); return true; } }); buf.append( "}" ); return buf.toString(); }
/** {@inheritDoc} */ public double put( long key, double value ) { int index = insertionIndex( key ); return doPut( key, value, index ); }
/** {@inheritDoc} */ public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException { // VERSION in.readByte(); // SUPER super.readExternal( in ); // NUMBER OF ENTRIES int size = in.readInt(); setUp( size ); // ENTRIES while (size-- > 0) { long key = in.readLong(); double val = in.readDouble(); put(key, val); } } } // TLongDoubleHashMap
/** {@inheritDoc} */ public boolean contains( double entry ) { return TLongDoubleHashMap.this.containsValue( entry ); }
/** {@inheritDoc} */ public boolean containsAll( long[] array ) { for ( long element : array ) { if ( ! TLongDoubleHashMap.this.contains( element ) ) { return false; } } return true; }
/** {@inheritDoc} */ public void clear() { TLongDoubleHashMap.this.clear(); }
/** * Creates a new <code>TLongDoubleHashMap</code> instance containing * all of the entries in the map passed in. * * @param keys a <tt>long</tt> array containing the keys for the matching values. * @param values a <tt>double</tt> array containing the values. */ public TLongDoubleHashMap( long[] keys, double[] values ) { super( Math.max( keys.length, values.length ) ); int size = Math.min( keys.length, values.length ); for ( int i = 0; i < size; i++ ) { this.put( keys[i], values[i] ); } }
/** {@inheritDoc} */ @Override public boolean forEachKey( TLongProcedure procedure ) { return forEach( procedure ); }