當前位置: 首頁>>代碼示例>>Java>>正文


Java LongAdder.reset方法代碼示例

本文整理匯總了Java中java.util.concurrent.atomic.LongAdder.reset方法的典型用法代碼示例。如果您正苦於以下問題:Java LongAdder.reset方法的具體用法?Java LongAdder.reset怎麽用?Java LongAdder.reset使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在java.util.concurrent.atomic.LongAdder的用法示例。


在下文中一共展示了LongAdder.reset方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: testDoublesCount

import java.util.concurrent.atomic.LongAdder; //導入方法依賴的package包/類
/**
 * A parallel sized stream of doubles generates the given number of values
 */
public void testDoublesCount() {
    LongAdder counter = new LongAdder();
    ThreadLocalRandom r = ThreadLocalRandom.current();
    long size = 0;
    for (int reps = 0; reps < REPS; ++reps) {
        counter.reset();
        r.doubles(size).parallel().forEach(x -> {
            counter.increment();
        });
        assertEquals(counter.sum(), size);
        size += 524959;
    }
}
 
開發者ID:lambdalab-mirror,項目名稱:jdk8u-jdk,代碼行數:17,代碼來源:ThreadLocalRandomTest.java

示例2: testIntsCount

import java.util.concurrent.atomic.LongAdder; //導入方法依賴的package包/類
/**
 * A parallel sized stream of ints generates the given number of values
 */
public void testIntsCount() {
    LongAdder counter = new LongAdder();
    ThreadLocalRandom r = ThreadLocalRandom.current();
    long size = 0;
    for (int reps = 0; reps < REPS; ++reps) {
        counter.reset();
        r.ints(size).parallel().forEach(x -> {
            counter.increment();
        });
        assertEquals(counter.sum(), size);
        size += 524959;
    }
}
 
開發者ID:lambdalab-mirror,項目名稱:jdk8u-jdk,代碼行數:17,代碼來源:ThreadLocalRandomTest.java

示例3: testLongsCount

import java.util.concurrent.atomic.LongAdder; //導入方法依賴的package包/類
/**
 * A parallel sized stream of longs generates the given number of values
 */
public void testLongsCount() {
    LongAdder counter = new LongAdder();
    ThreadLocalRandom r = ThreadLocalRandom.current();
    long size = 0;
    for (int reps = 0; reps < REPS; ++reps) {
        counter.reset();
        r.longs(size).parallel().forEach(x -> {
            counter.increment();
        });
        assertEquals(counter.sum(), size);
        size += 524959;
    }
}
 
開發者ID:lambdalab-mirror,項目名稱:jdk8u-jdk,代碼行數:17,代碼來源:ThreadLocalRandomTest.java

示例4: testIntsCount

import java.util.concurrent.atomic.LongAdder; //導入方法依賴的package包/類
/**
 * A parallel sized stream of ints generates the given number of values
 */
public void testIntsCount() {
    LongAdder counter = new LongAdder();
    SplittableRandom r = new SplittableRandom();
    long size = 0;
    for (int reps = 0; reps < REPS; ++reps) {
        counter.reset();
        r.ints(size).parallel().forEach(x -> {counter.increment();});
        assertEquals(counter.sum(), size);
        size += 524959;
    }
}
 
開發者ID:lambdalab-mirror,項目名稱:jdk8u-jdk,代碼行數:15,代碼來源:SplittableRandomTest.java

示例5: testLongsCount

import java.util.concurrent.atomic.LongAdder; //導入方法依賴的package包/類
/**
 * A parallel sized stream of longs generates the given number of values
 */
public void testLongsCount() {
    LongAdder counter = new LongAdder();
    SplittableRandom r = new SplittableRandom();
    long size = 0;
    for (int reps = 0; reps < REPS; ++reps) {
        counter.reset();
        r.longs(size).parallel().forEach(x -> {counter.increment();});
        assertEquals(counter.sum(), size);
        size += 524959;
    }
}
 
開發者ID:lambdalab-mirror,項目名稱:jdk8u-jdk,代碼行數:15,代碼來源:SplittableRandomTest.java

示例6: testDoublesCount

import java.util.concurrent.atomic.LongAdder; //導入方法依賴的package包/類
/**
 * A parallel sized stream of doubles generates the given number of values
 */
public void testDoublesCount() {
    LongAdder counter = new LongAdder();
    SplittableRandom r = new SplittableRandom();
    long size = 0;
    for (int reps = 0; reps < REPS; ++reps) {
        counter.reset();
        r.doubles(size).parallel().forEach(x -> {counter.increment();});
        assertEquals(counter.sum(), size);
        size += 524959;
    }
}
 
開發者ID:lambdalab-mirror,項目名稱:jdk8u-jdk,代碼行數:15,代碼來源:SplittableRandomTest.java

示例7: testIntsCount

import java.util.concurrent.atomic.LongAdder; //導入方法依賴的package包/類
/**
 * A sequential sized stream of ints generates the given number of values
 */
public void testIntsCount() {
    LongAdder counter = new LongAdder();
    Random r = new Random();
    long size = 0;
    for (int reps = 0; reps < REPS; ++reps) {
        counter.reset();
        r.ints(size).forEach(x -> {
            counter.increment();
        });
        assertEquals(counter.sum(), size);
        size += 524959;
    }
}
 
開發者ID:lambdalab-mirror,項目名稱:jdk8u-jdk,代碼行數:17,代碼來源:RandomTest.java

示例8: testLongsCount

import java.util.concurrent.atomic.LongAdder; //導入方法依賴的package包/類
/**
 * A sequential sized stream of longs generates the given number of values
 */
public void testLongsCount() {
    LongAdder counter = new LongAdder();
    Random r = new Random();
    long size = 0;
    for (int reps = 0; reps < REPS; ++reps) {
        counter.reset();
        r.longs(size).forEach(x -> {
            counter.increment();
        });
        assertEquals(counter.sum(), size);
        size += 524959;
    }
}
 
開發者ID:lambdalab-mirror,項目名稱:jdk8u-jdk,代碼行數:17,代碼來源:RandomTest.java

示例9: testDoublesCount

import java.util.concurrent.atomic.LongAdder; //導入方法依賴的package包/類
/**
 * A sequential sized stream of doubles generates the given number of values
 */
public void testDoublesCount() {
    LongAdder counter = new LongAdder();
    Random r = new Random();
    long size = 0;
    for (int reps = 0; reps < REPS; ++reps) {
        counter.reset();
        r.doubles(size).forEach(x -> {
            counter.increment();
        });
        assertEquals(counter.sum(), size);
        size += 524959;
    }
}
 
開發者ID:lambdalab-mirror,項目名稱:jdk8u-jdk,代碼行數:17,代碼來源:RandomTest.java

示例10: testIntsCount

import java.util.concurrent.atomic.LongAdder; //導入方法依賴的package包/類
/**
 * A parallel sized stream of ints generates the given number of values
 */
public void testIntsCount() {
    LongAdder counter = new LongAdder();
    SplittableRandom r = new SplittableRandom();
    long size = 0;
    for (int reps = 0; reps < REPS; ++reps) {
        counter.reset();
        r.ints(size).parallel().forEach(x -> counter.increment());
        assertEquals(size, counter.sum());
        size += 524959;
    }
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:15,代碼來源:SplittableRandomTest.java

示例11: testLongsCount

import java.util.concurrent.atomic.LongAdder; //導入方法依賴的package包/類
/**
 * A parallel sized stream of longs generates the given number of values
 */
public void testLongsCount() {
    LongAdder counter = new LongAdder();
    SplittableRandom r = new SplittableRandom();
    long size = 0;
    for (int reps = 0; reps < REPS; ++reps) {
        counter.reset();
        r.longs(size).parallel().forEach(x -> counter.increment());
        assertEquals(size, counter.sum());
        size += 524959;
    }
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:15,代碼來源:SplittableRandomTest.java

示例12: testDoublesCount

import java.util.concurrent.atomic.LongAdder; //導入方法依賴的package包/類
/**
 * A parallel sized stream of doubles generates the given number of values
 */
public void testDoublesCount() {
    LongAdder counter = new LongAdder();
    SplittableRandom r = new SplittableRandom();
    long size = 0;
    for (int reps = 0; reps < REPS; ++reps) {
        counter.reset();
        r.doubles(size).parallel().forEach(x -> counter.increment());
        assertEquals(size, counter.sum());
        size += 524959;
    }
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:15,代碼來源:SplittableRandomTest.java

示例13: testIntsCount

import java.util.concurrent.atomic.LongAdder; //導入方法依賴的package包/類
/**
 * A parallel sized stream of ints generates the given number of values
 */
public void testIntsCount() {
    LongAdder counter = new LongAdder();
    ThreadLocalRandom r = ThreadLocalRandom.current();
    long size = 0;
    for (int reps = 0; reps < REPS; ++reps) {
        counter.reset();
        r.ints(size).parallel().forEach(x -> counter.increment());
        assertEquals(size, counter.sum());
        size += 524959;
    }
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:15,代碼來源:ThreadLocalRandom8Test.java

示例14: testLongsCount

import java.util.concurrent.atomic.LongAdder; //導入方法依賴的package包/類
/**
 * A parallel sized stream of longs generates the given number of values
 */
public void testLongsCount() {
    LongAdder counter = new LongAdder();
    ThreadLocalRandom r = ThreadLocalRandom.current();
    long size = 0;
    for (int reps = 0; reps < REPS; ++reps) {
        counter.reset();
        r.longs(size).parallel().forEach(x -> counter.increment());
        assertEquals(size, counter.sum());
        size += 524959;
    }
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:15,代碼來源:ThreadLocalRandom8Test.java

示例15: testDoublesCount

import java.util.concurrent.atomic.LongAdder; //導入方法依賴的package包/類
/**
 * A parallel sized stream of doubles generates the given number of values
 */
public void testDoublesCount() {
    LongAdder counter = new LongAdder();
    ThreadLocalRandom r = ThreadLocalRandom.current();
    long size = 0;
    for (int reps = 0; reps < REPS; ++reps) {
        counter.reset();
        r.doubles(size).parallel().forEach(x -> counter.increment());
        assertEquals(size, counter.sum());
        size += 524959;
    }
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:15,代碼來源:ThreadLocalRandom8Test.java


注:本文中的java.util.concurrent.atomic.LongAdder.reset方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。