本文整理了Java中java.util.IdentityHashMap.computeIfAbsent()
方法的一些代码示例,展示了IdentityHashMap.computeIfAbsent()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。IdentityHashMap.computeIfAbsent()
方法的具体详情如下:
包路径:java.util.IdentityHashMap
类名称:IdentityHashMap
方法名:computeIfAbsent
暂无
代码示例来源:origin: apache/incubator-druid
private WritableMemory getMemory(final ByteBuffer buf)
{
return memCache.computeIfAbsent(buf, b -> WritableMemory.wrap(b, ByteOrder.LITTLE_ENDIAN));
}
代码示例来源:origin: apache/incubator-druid
private WritableMemory getMemory(final ByteBuffer buffer)
{
return memCache.computeIfAbsent(buffer, buf -> WritableMemory.wrap(buf));
}
代码示例来源:origin: apache/incubator-druid
private WritableMemory getMemory(final ByteBuffer buffer)
{
return memCache.computeIfAbsent(buffer, buf -> WritableMemory.wrap(buf, ByteOrder.LITTLE_ENDIAN));
}
代码示例来源:origin: apache/incubator-druid
private void putSketch(final ByteBuffer buffer, final int position, final UpdateDoublesSketch sketch)
{
Int2ObjectMap<UpdateDoublesSketch> map = sketches.computeIfAbsent(buffer, buf -> new Int2ObjectOpenHashMap<>());
map.put(position, sketch);
}
代码示例来源:origin: apache/incubator-druid
private void putSketchIntoCache(final ByteBuffer buf, final int position, final HllSketch sketch)
{
final Int2ObjectMap<HllSketch> map = sketchCache.computeIfAbsent(buf, b -> new Int2ObjectOpenHashMap<>());
map.put(position, sketch);
}
代码示例来源:origin: apache/incubator-druid
private void putUnion(final ByteBuffer buffer, final int position, final DoublesUnion union)
{
Int2ObjectMap<DoublesUnion> map = unions.computeIfAbsent(buffer, buf -> new Int2ObjectOpenHashMap<>());
map.put(position, union);
}
代码示例来源:origin: apache/hbase
private void addError(Action action, Throwable error, ServerName serverName) {
List<ThrowableWithExtraContext> errors;
synchronized (action2Errors) {
errors = action2Errors.computeIfAbsent(action, k -> new ArrayList<>());
}
errors.add(new ThrowableWithExtraContext(error, EnvironmentEdgeManager.currentTime(),
getExtraContextForError(serverName)));
}
代码示例来源:origin: org.apache.hbase/hbase-client
private void addError(Action action, Throwable error, ServerName serverName) {
List<ThrowableWithExtraContext> errors;
synchronized (action2Errors) {
errors = action2Errors.computeIfAbsent(action, k -> new ArrayList<>());
}
errors.add(new ThrowableWithExtraContext(error, EnvironmentEdgeManager.currentTime(),
getExtraContextForError(serverName)));
}
代码示例来源:origin: BaseXdb/basex
/**
* Returns local thread for the given expression.
* @param expr expression
* @return cache
*/
public ThreadLocal<FTTokenizer> get(final FTWords expr) {
return ftCache.computeIfAbsent(expr, p -> new ThreadLocal<>());
}
代码示例来源:origin: batfish/batfish
public Transition toTransition(@Nullable Transformation transformation) {
return transformation == null
? Identity.INSTANCE
: _cache.computeIfAbsent(transformation, this::computeTransition);
}
代码示例来源:origin: com.pragmaticobjects.oo.atom/atom-basis
private final Long resolveAttribute(Attribute attr) {
return attributesTable.computeIfAbsent(attr, k -> random.nextLong());
}
代码示例来源:origin: BaseXdb/basex
/**
* Returns local thread for the given expression.
* @param expr expression
* @return cache
*/
public ThreadLocal<PathCache> get(final AxisPath expr) {
return pathCache.computeIfAbsent(expr, p -> ThreadLocal.withInitial(PathCache::new));
}
代码示例来源:origin: BaseXdb/basex
/**
* Returns local thread for the given expression.
* @param expr expression
* @return cache
*/
public ThreadLocal<CmpCache> get(final CmpHashG expr) {
return cmpCache.computeIfAbsent(expr, p -> ThreadLocal.withInitial(CmpCache::new));
}
代码示例来源:origin: org.basex/basex
/**
* Returns local thread for the given expression.
* @param expr expression
* @return cache
*/
public ThreadLocal<PathCache> get(final AxisPath expr) {
return pathCache.computeIfAbsent(expr, p -> ThreadLocal.withInitial(PathCache::new));
}
代码示例来源:origin: org.basex/basex
/**
* Returns local thread for the given expression.
* @param expr expression
* @return cache
*/
public ThreadLocal<CmpCache> get(final CmpHashG expr) {
return cmpCache.computeIfAbsent(expr, p -> ThreadLocal.withInitial(CmpCache::new));
}
代码示例来源:origin: org.apache.druid.extensions/druid-datasketches
private void putSketchIntoCache(final ByteBuffer buf, final int position, final HllSketch sketch)
{
final Int2ObjectMap<HllSketch> map = sketchCache.computeIfAbsent(buf, b -> new Int2ObjectOpenHashMap<>());
map.put(position, sketch);
}
代码示例来源:origin: com.aliyun.hbase/alihbase-client
private void addError(Action action, Throwable error, ServerName serverName) {
List<ThrowableWithExtraContext> errors;
synchronized (action2Errors) {
errors = action2Errors.computeIfAbsent(action, k -> new ArrayList<>());
}
errors.add(new ThrowableWithExtraContext(error, EnvironmentEdgeManager.currentTime(),
getExtraContextForError(serverName)));
}
代码示例来源:origin: org.apache.druid.extensions/druid-datasketches
private void putSketch(final ByteBuffer buffer, final int position, final UpdateDoublesSketch sketch)
{
Int2ObjectMap<UpdateDoublesSketch> map = sketches.computeIfAbsent(buffer, buf -> new Int2ObjectOpenHashMap<>());
map.put(position, sketch);
}
代码示例来源:origin: com.carrotsearch.progresso/progresso
@Override
public void taskStarted(Task<?> task) {
if (task.getTracker() instanceof LongTracker) {
LongTracker tracker = (LongTracker) task.getTracker();
RateCalculator rateCalculator = rateCalculators.computeIfAbsent(tracker, (key) -> new RateCalculator());
rateCalculator.tick(System.currentTimeMillis(), tracker.at());
}
}
代码示例来源:origin: com.carrotsearch.progresso/progresso
@Override
public void taskStarted(Task<?> task) {
if (task.getTracker() instanceof LongTracker) {
LongTracker tracker = (LongTracker) task.getTracker();
RateCalculator rateCalculator = rateCalculators.computeIfAbsent(tracker, (key) -> new RateCalculator());
rateCalculator.tick(System.currentTimeMillis(), tracker.at());
}
}
内容来源于网络,如有侵权,请联系作者删除!