/** {@inheritDoc} */ @Override public boolean equals( Object other ) { if ( ! ( other instanceof TIntIntMap ) ) { return false; } TIntIntMap that = ( TIntIntMap ) other; if ( that.size() != this.size() ) { return false; } int[] values = _values; byte[] states = _states; int this_no_entry_value = getNoEntryValue(); int that_no_entry_value = that.getNoEntryValue(); for ( int i = values.length; i-- > 0; ) { if ( states[i] == FULL ) { int key = _set[i]; int that_value = that.get( key ); int this_value = values[i]; if ( ( this_value != that_value ) && ( this_value != this_no_entry_value ) && ( that_value != that_no_entry_value ) ) { return false; } } } return true; }
/** See {@link gnu.trove.map.hash.TIntIntHashMap#getNoEntryValue()} */ public int getNoEntryValue() { return delegate.getNoEntryValue(); }
/** See {@link gnu.trove.map.hash.TIntIntHashMap#getNoEntryValue()} */ public int getNoEntryValue() { return delegate.getNoEntryValue(); }
/** {@inheritDoc} */ @Override public boolean equals( Object other ) { if ( ! ( other instanceof TIntIntMap ) ) { return false; } TIntIntMap that = ( TIntIntMap ) other; if ( that.size() != this.size() ) { return false; } int[] values = _values; byte[] states = _states; int this_no_entry_value = getNoEntryValue(); int that_no_entry_value = that.getNoEntryValue(); for ( int i = values.length; i-- > 0; ) { if ( states[i] == FULL ) { int key = _set[i]; int that_value = that.get( key ); int this_value = values[i]; if ( ( this_value != that_value ) && ( this_value != this_no_entry_value ) && ( that_value != that_no_entry_value ) ) { return false; } } } return true; }
/** {@inheritDoc} */ @Override public boolean equals( Object other ) { if ( ! ( other instanceof TIntIntMap ) ) { return false; } TIntIntMap that = ( TIntIntMap ) other; if ( that.size() != this.size() ) { return false; } int[] values = _values; byte[] states = _states; int this_no_entry_value = getNoEntryValue(); int that_no_entry_value = that.getNoEntryValue(); for ( int i = values.length; i-- > 0; ) { if ( states[i] == FULL ) { int key = _set[i]; int that_value = that.get( key ); int this_value = values[i]; if ( ( this_value != that_value ) && ( this_value != this_no_entry_value ) && ( that_value != that_no_entry_value ) ) { return false; } } } return true; }
/** {@inheritDoc} */ @Override public boolean equals( Object other ) { if ( ! ( other instanceof TIntIntMap ) ) { return false; } TIntIntMap that = ( TIntIntMap ) other; if ( that.size() != this.size() ) { return false; } int[] values = _values; byte[] states = _states; int this_no_entry_value = getNoEntryValue(); int that_no_entry_value = that.getNoEntryValue(); for ( int i = values.length; i-- > 0; ) { if ( states[i] == FULL ) { int key = _set[i]; int that_value = that.get( key ); int this_value = values[i]; if ( ( this_value != that_value ) && ( this_value != this_no_entry_value ) && ( that_value != that_no_entry_value ) ) { return false; } } } return true; }
/** {@inheritDoc} */ @Override public boolean equals( Object other ) { if ( ! ( other instanceof TIntIntMap ) ) { return false; } TIntIntMap that = ( TIntIntMap ) other; if ( that.size() != this.size() ) { return false; } int[] values = _values; byte[] states = _states; int this_no_entry_value = getNoEntryValue(); int that_no_entry_value = that.getNoEntryValue(); for ( int i = values.length; i-- > 0; ) { if ( states[i] == FULL ) { int key = _set[i]; if ( !that.containsKey( key ) ) return false; int that_value = that.get( key ); int this_value = values[i]; if ((this_value != that_value) && ( (this_value != this_no_entry_value) || (that_value != that_no_entry_value)) ) { return false; } } } return true; }
/** * Based on writeExternal in the hierarchy of TIntIntHashMap. */ @Override public void write(Kryo kryo, Output output, TIntIntHashMap map) { // Do not write load and compaction factors. // They're not public and we don't ever modify them in a principled way. // No-entry key and value. Often zero or -1 so don't optimize for positive values, do optimize for small values. output.writeVarInt(map.getNoEntryKey(), false); output.writeVarInt(map.getNoEntryValue(), false); // Number of entries, always zero or positive. output.writeVarInt(map.size(), true); // All entries, most are positive in our application? if (varInts) { map.forEachEntry((k, v) -> { output.writeVarInt(k, optimizePositive); output.writeVarInt(v, optimizePositive); return true; }); } else { map.forEachEntry((k, v) -> { output.writeInt(k, optimizePositive); output.writeInt(v, optimizePositive); return true; }); } }
/** * Based on writeExternal in the hierarchy of TIntIntHashMap. */ @Override public void write(Kryo kryo, Output output, TIntIntHashMap map) { // Do not write load and compaction factors. // They're not public and we don't ever modify them in a principled way. // No-entry key and value. Often zero or -1 so don't optimize for positive values, do optimize for small values. output.writeVarInt(map.getNoEntryKey(), false); output.writeVarInt(map.getNoEntryValue(), false); // Number of entries, always zero or positive. output.writeVarInt(map.size(), true); // All entries, most are positive in our application? if (varInts) { map.forEachEntry((k, v) -> { output.writeVarInt(k, optimizePositive); output.writeVarInt(v, optimizePositive); return true; }); } else { map.forEachEntry((k, v) -> { output.writeInt(k, optimizePositive); output.writeInt(v, optimizePositive); return true; }); } }