本文整理了Java中gnu.trove.map.TIntIntMap.getNoEntryValue()
方法的一些代码示例,展示了TIntIntMap.getNoEntryValue()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。TIntIntMap.getNoEntryValue()
方法的具体详情如下:
包路径:gnu.trove.map.TIntIntMap
类名称:TIntIntMap
方法名:getNoEntryValue
[英]Returns the value that will be returned from #get or #put if no entry exists for a given key. The default value is generally zero, but can be changed during construction of the collection.
[中]
代码示例来源:origin: alibaba/mdrill
public int getNoEntryValue() { return m.getNoEntryValue(); }
代码示例来源:origin: alibaba/mdrill
public int getNoEntryValue() { return m.getNoEntryValue(); }
代码示例来源:origin: alibaba/mdrill
/**
* Inserts a key/value pair into the map.
*
* @param key an <code>Object</code> value
* @param value an <code>Object</code> value
* @return the previous value associated with <tt>key</tt>,
* or Integer(0) if none was found.
*/
public Integer put( Integer key, Integer value ) {
int k;
int v;
if ( key == null ) {
k = _map.getNoEntryKey();
} else {
k = unwrapKey( key );
}
if ( value == null ) {
v = _map.getNoEntryValue();
} else {
v = unwrapValue( value );
}
int retval = _map.put( k, v );
if ( retval == _map.getNoEntryValue() ) {
return null;
}
return wrapValue( retval );
}
代码示例来源:origin: alibaba/mdrill
/**
* Deletes a key/value pair from the map.
*
* @param key an <code>Object</code> value
* @return the removed value, or null if it was not found in the map
*/
public Integer remove( Object key ) {
int k;
if ( key != null ) {
if ( key instanceof Integer ) {
k = unwrapKey( key );
} else {
return null;
}
} else {
k = _map.getNoEntryKey();
}
int v = _map.remove( k );
// There may be a false positive since primitive maps
// cannot return null, so we have to do an extra
// check here.
if ( v == _map.getNoEntryValue() ) {
return null;
} else {
return wrapValue( v );
}
}
代码示例来源:origin: alibaba/mdrill
/** {@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;
}
代码示例来源:origin: alibaba/mdrill
/**
* Retrieves the value for <tt>key</tt>
*
* @param key an <code>Object</code> value
* @return the value of <tt>key</tt> or null if no such mapping exists.
*/
public Integer get( Object key ) {
int k;
if ( key != null ) {
if ( key instanceof Integer ) {
k = unwrapKey( key );
} else {
return null;
}
} else {
k = _map.getNoEntryKey();
}
int v = _map.get( k );
// There may be a false positive since primitive maps
// cannot return null, so we have to do an extra
// check here.
if ( v == _map.getNoEntryValue() ) {
return null;
} else {
return wrapValue( v );
}
}
代码示例来源:origin: net.sf.trove4j/trove4j
public int getNoEntryValue() { return m.getNoEntryValue(); }
代码示例来源:origin: com.palantir.patches.sourceforge/trove3
@Override
public int getNoEntryValue() { return m.getNoEntryValue(); }
代码示例来源:origin: net.sf.trove4j/trove4j
public int getNoEntryValue() { return m.getNoEntryValue(); }
代码示例来源:origin: hernad/easyrec
public int getNoEntryValue() { return m.getNoEntryValue(); }
代码示例来源:origin: com.palantir.patches.sourceforge/trove3
@Override
public int getNoEntryValue() { return m.getNoEntryValue(); }
代码示例来源:origin: net.sf.trove4j/core
public int getNoEntryValue() { return m.getNoEntryValue(); }
代码示例来源:origin: net.sf.trove4j/core
public int getNoEntryValue() { return m.getNoEntryValue(); }
代码示例来源:origin: hernad/easyrec
public int getNoEntryValue() { return m.getNoEntryValue(); }
代码示例来源:origin: de.unijena.bioinf.phylo/mincut
public boolean remove(int item) {
@SuppressWarnings(value = "element-type-mismatch")
int index = idx.get(item);
if (index == idx.getNoEntryValue()) {
return false;
}
removeAt(index);
return true;
}
代码示例来源:origin: PenguinSquad/Harvest-Festival
public static int getBlendedColour(TIntIntMap map, int original, int additional) {
try {
int ret = map.get(original);
if (ret != map.getNoEntryValue()) return ret;
else {
int size = 2;
int r = (original & 0xFF0000) >> 16;
int g = (original & 0x00FF00) >> 8;
int b = original & 0x0000FF;
r += (additional & 0xFF0000) >> 16;
g += (additional & 0x00FF00) >> 8;
b += additional & 0x0000FF;
int value = (r / size & 255) << 16 | (g / size & 255) << 8 | b / size & 255;
map.put(original, value);
return value;
}
} catch (IndexOutOfBoundsException exception) {
return original;
}
}
代码示例来源:origin: com.palantir.patches.sourceforge/trove3
/**
* Retrieves the value for <tt>key</tt>
*
* @param key an <code>Object</code> value
* @return the value of <tt>key</tt> or null if no such mapping exists.
*/
@Override
public Integer get( Object key ) {
if (! ( key instanceof Integer ) ) {
return null;
}
int k = unwrapKey( key );
int v = _map.get( k );
if (v == _map.getNoEntryValue() && !_map.containsKey( k ) ) {
return null;
}
return wrapValue( v );
}
代码示例来源:origin: net.sf.trove4j/trove4j
/**
* Retrieves the value for <tt>key</tt>
*
* @param key an <code>Object</code> value
* @return the value of <tt>key</tt> or null if no such mapping exists.
*/
public Integer get( Object key ) {
int k;
if ( key != null ) {
if ( key instanceof Integer ) {
k = unwrapKey( key );
} else {
return null;
}
} else {
k = _map.getNoEntryKey();
}
int v = _map.get( k );
// There may be a false positive since primitive maps
// cannot return null, so we have to do an extra
// check here.
if ( v == _map.getNoEntryValue() ) {
return null;
} else {
return wrapValue( v );
}
}
代码示例来源:origin: net.sf.trove4j/trove4j
/**
* Deletes a key/value pair from the map.
*
* @param key an <code>Object</code> value
* @return the removed value, or null if it was not found in the map
*/
public Integer remove( Object key ) {
int k;
if ( key != null ) {
if ( key instanceof Integer ) {
k = unwrapKey( key );
} else {
return null;
}
} else {
k = _map.getNoEntryKey();
}
int v = _map.remove( k );
// There may be a false positive since primitive maps
// cannot return null, so we have to do an extra
// check here.
if ( v == _map.getNoEntryValue() ) {
return null;
} else {
return wrapValue( v );
}
}
代码示例来源:origin: net.sf.trove4j/trove4j
/** {@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;
}
内容来源于网络,如有侵权,请联系作者删除!