com.carrotsearch.hppc.ObjectIntHashMap.indexOf()方法的使用及代码示例

x33g5p2x  于2022-01-26 转载在 其他  
字(3.0k)|赞(0)|评价(0)|浏览(92)

本文整理了Java中com.carrotsearch.hppc.ObjectIntHashMap.indexOf()方法的一些代码示例,展示了ObjectIntHashMap.indexOf()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ObjectIntHashMap.indexOf()方法的具体详情如下:
包路径:com.carrotsearch.hppc.ObjectIntHashMap
类名称:ObjectIntHashMap
方法名:indexOf

ObjectIntHashMap.indexOf介绍

暂无

代码示例

代码示例来源:origin: carrotsearch/hppc

/**
 * <a href="http://trove4j.sourceforge.net">Trove</a>-inspired API method. An equivalent
 * of the following code:
 * <pre>
 * if (!map.containsKey(key)) map.put(value);
 * </pre>
 * 
 * @param key The key of the value to check.
 * @param value The value to put if <code>key</code> does not exist.
 * @return <code>true</code> if <code>key</code> did not exist and <code>value</code>
 * was placed in the map.
 */
public boolean putIfAbsent(KType key, int value) {
 int keyIndex = indexOf(key);
 if (!indexExists(keyIndex)) {
  indexInsert(keyIndex, key, value);
  return true;
 } else {
  return false;
 }
}

代码示例来源:origin: carrotsearch/hppc

/**
 * If <code>key</code> exists, <code>putValue</code> is inserted into the map,
 * otherwise any existing value is incremented by <code>additionValue</code>.
 * 
 * @param key
 *          The key of the value to adjust.
 * @param putValue
 *          The value to put if <code>key</code> does not exist.
 * @param incrementValue
 *          The value to add to the existing value if <code>key</code> exists.
 * @return Returns the current value associated with <code>key</code> (after
 *         changes).
 */
@Override
public int putOrAdd(KType key, int putValue, int incrementValue) {
 assert assigned < mask + 1;
 int keyIndex = indexOf(key);
 if (indexExists(keyIndex)) {
  putValue = ((int) (( values[keyIndex]) + (incrementValue)));
  indexReplace(keyIndex, putValue);
 } else {
  indexInsert(keyIndex, key, putValue);
 }
 return putValue;
}

代码示例来源:origin: org.elasticsearch/elasticsearch

if (count > 0 && (keySlot = seenSurfaceForms.indexOf(surface)) >= 0) {
  surfaceIndex = seenSurfaceForms.indexGet(keySlot);
  SurfaceFormAndPayload surfaceFormAndPayload = surfaceFormsAndPayload[surfaceIndex];

代码示例来源:origin: harbby/presto-connectors

if (count > 0 && (keySlot = seenSurfaceForms.indexOf(surface)) >= 0) {
  surfaceIndex = seenSurfaceForms.indexGet(keySlot);
  SurfaceFormAndPayload surfaceFormAndPayload = surfaceFormsAndPayload[surfaceIndex];

代码示例来源:origin: apache/servicemix-bundles

if (count > 0 && (keySlot = seenSurfaceForms.indexOf(surface)) >= 0) {
  surfaceIndex = seenSurfaceForms.indexGet(keySlot);
  SurfaceFormAndPayload surfaceFormAndPayload = surfaceFormsAndPayload[surfaceIndex];

代码示例来源:origin: com.strapdata.elasticsearch/elasticsearch

if (count > 0 && (keySlot = seenSurfaceForms.indexOf(surface)) >= 0) {
  surfaceIndex = seenSurfaceForms.indexGet(keySlot);
  SurfaceFormAndPayload surfaceFormAndPayload = surfaceFormsAndPayload[surfaceIndex];

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.elasticsearch

if (count > 0 && (keySlot = seenSurfaceForms.indexOf(surface)) >= 0) {
  surfaceIndex = seenSurfaceForms.indexGet(keySlot);
  SurfaceFormAndPayload surfaceFormAndPayload = surfaceFormsAndPayload[surfaceIndex];

相关文章