本文整理了Java中com.google.common.util.concurrent.AtomicLongMap.addAndGet()方法的一些代码示例,展示了
本文整理了Java中com.google.common.util.concurrent.AtomicLongMap.addAndGet()
方法的一些代码示例,展示了AtomicLongMap.addAndGet()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。AtomicLongMap.addAndGet()
方法的具体详情如下:
包路径:com.google.common.util.concurrent.AtomicLongMap
类名称:AtomicLongMap
方法名:addAndGet
AtomicLongMap.addAndGet介绍
[英]Adds delta to the value currently associated with key, and returns the new value.
[中]将增量添加到当前与键关联的值,并返回新值。
代码示例
代码示例来源:origin: google/guava
/**
* Increments by one the value currently associated with {@code key}, and returns the new value.
*/
@CanIgnoreReturnValue
public long incrementAndGet(K key) {
return addAndGet(key, 1);
}
代码示例来源:origin: google/guava
/**
* Decrements by one the value currently associated with {@code key}, and returns the new value.
*/
@CanIgnoreReturnValue
public long decrementAndGet(K key) {
return addAndGet(key, -1);
}
代码示例来源:origin: google/j2objc
/**
* Increments by one the value currently associated with {@code key}, and returns the new value.
*/
@CanIgnoreReturnValue
public long incrementAndGet(K key) {
return addAndGet(key, 1);
}
代码示例来源:origin: google/j2objc
/**
* Decrements by one the value currently associated with {@code key}, and returns the new value.
*/
@CanIgnoreReturnValue
public long decrementAndGet(K key) {
return addAndGet(key, -1);
}
代码示例来源:origin: wildfly/wildfly
/**
* Increments by one the value currently associated with {@code key}, and returns the new value.
*/
@CanIgnoreReturnValue
public long incrementAndGet(K key) {
return addAndGet(key, 1);
}
代码示例来源:origin: wildfly/wildfly
/**
* Decrements by one the value currently associated with {@code key}, and returns the new value.
*/
@CanIgnoreReturnValue
public long decrementAndGet(K key) {
return addAndGet(key, -1);
}
代码示例来源:origin: atomix/atomix
@Override
public long addAndGet(long delta) {
return getIncrement(increments.addAndGet(localMemberId, delta));
}
代码示例来源:origin: google/guava
public void testAddAndGet_zero() {
AtomicLongMap map = AtomicLongMap.create();
String key = "key";
long value = random.nextInt(MAX_ADDEND);
assertEquals(0L, map.get(key));
assertFalse(map.containsKey(key));
assertEquals(value, map.addAndGet(key, value));
assertEquals(value, map.get(key));
assertEquals(0L, map.addAndGet(key, -1 * value));
assertEquals(0L, map.get(key));
assertTrue(map.containsKey(key));
assertEquals(value, map.addAndGet(key, value));
assertEquals(value, map.get(key));
}
代码示例来源:origin: google/guava
break;
case 2:
map.addAndGet(key, delta);
threadSum += delta;
break;
代码示例来源:origin: google/guava
public void testAddAndGet() {
AtomicLongMap map = AtomicLongMap.create();
String key = "key";
long addend = random.nextInt(MAX_ADDEND);
for (int i = 0; i long before = map.get(key);
long result = map.addAndGet(key, addend);
long after = map.get(key);
assertEquals(before + addend, after);
assertEquals(after, result);
addend = after;
}
assertEquals(1, map.size());
assertTrue(!map.isEmpty());
assertTrue(map.containsKey(key));
}
代码示例来源:origin: com.google.guava/guava-jdk5
/**
* Increments by one the value currently associated with {@code key}, and returns the new value.
*/
public long incrementAndGet(K key) {
return addAndGet(key, 1);
}
代码示例来源:origin: org.hudsonci.lib.guava/guava
/**
* Decrements by one the value currently associated with {@code key}, and returns the new value.
*/
public long decrementAndGet(K key) {
return addAndGet(key, -1);
}
代码示例来源:origin: org.kill-bill.billing/killbill-osgi-bundles-jruby
/**
* Decrements by one the value currently associated with {@code key}, and returns the new value.
*/
public long decrementAndGet(K key) {
return addAndGet(key, -1);
}
代码示例来源:origin: com.sap.cloud.s4hana.cloudplatform/metering-scp-neo
/**
* Record a single access by the tenant to the API specified by the key.
*
* @param key
* The metric key.
* @return The updated number of accesses.
*/
public long record( final TenantMetricKeyPair key )
{
return apiCounter.addAndGet(key, 1);
}
代码示例来源:origin: at.bestsolution.efxclipse.eclipse/com.google.guava
/**
* Increments by one the value currently associated with {@code key}, and returns the new value.
*/
public long incrementAndGet(K key) {
return addAndGet(key, 1);
}
代码示例来源:origin: com.diffplug.guava/guava-concurrent
/**
* Increments by one the value currently associated with {@code key}, and returns the new value.
*/
public long incrementAndGet(K key) {
return addAndGet(key, 1);
}
代码示例来源:origin: com.sap.cloud.s4hana.cloudplatform/metering-scp-neo
/**
* Record a specified number accesses by a the tenant to the API specified by the key.
*
* @param key
* The metric key.
* @param increment
* The number of API accesses to record.
* @return The updated number of accesses.
*/
public long record( final TenantMetricKeyPair key, final long increment )
{
return apiCounter.addAndGet(key, increment);
}
代码示例来源:origin: org.jboss.eap/wildfly-client-all
/**
* Increments by one the value currently associated with {@code key}, and returns the new value.
*/
@CanIgnoreReturnValue
public long incrementAndGet(K key) {
return addAndGet(key, 1);
}
代码示例来源:origin: org.kill-bill.billing/killbill-platform-osgi-bundles-logger
/**
* Increments by one the value currently associated with {@code key}, and returns the new value.
*/
@CanIgnoreReturnValue
public long incrementAndGet(K key) {
return addAndGet(key, 1);
}
代码示例来源:origin: com.github.cormoran-io.pepper/pepper
protected void adjustWithReference(AtomicLongMap currentHeapToAdjust,
Map extends String, ? extends Long> reference) {
// Remove the allocation what has been previously marked
for (String threadName : currentHeapToAdjust.asMap().keySet()) {
Long threadReferenceHeap = reference.get(threadName);
if (threadReferenceHeap != null) {
currentHeapToAdjust.addAndGet(threadName, -threadReferenceHeap);
}
}
}