Example usage for java.util.concurrent ConcurrentSkipListSet ConcurrentSkipListSet

List of usage examples for java.util.concurrent ConcurrentSkipListSet ConcurrentSkipListSet

Introduction

In this page you can find the example usage for java.util.concurrent ConcurrentSkipListSet ConcurrentSkipListSet.

Prototype

public ConcurrentSkipListSet() 

Source Link

Document

Constructs a new, empty set that orders its elements according to their Comparable natural ordering .

Usage

From source file:Main.java

public static <E> ConcurrentSkipListSet<E> getConcurrentSkipListSet() {
    return new ConcurrentSkipListSet<E>();
}

From source file:Main.java

public static <E> ConcurrentSkipListSet<E> createConcurrentSkipListSet() {
    return new ConcurrentSkipListSet<E>();
}

From source file:Main.java

public static <E> ConcurrentSkipListSet<E> createConcurrentSkipListSet(Collection<? extends E> collection) {
    if (collection == null) {
        return new ConcurrentSkipListSet<E>();
    }/*  w  w w . j av  a  2s  .c o m*/

    return new ConcurrentSkipListSet<E>(collection);
}

From source file:Main.java

public static <E> ConcurrentSkipListSet<E> createConcurrentSkipListSet(Comparator<? super E> comparator) {
    if (comparator == null) {
        return new ConcurrentSkipListSet<E>();
    }/*from   w  w  w  .j a v a 2  s.c o m*/

    return new ConcurrentSkipListSet<E>(comparator);
}

From source file:Main.java

public static <E> ConcurrentSkipListSet<E> newConcurrentSkipListSet() {
    return new ConcurrentSkipListSet<E>();
}

From source file:Main.java

public static <E> ConcurrentSkipListSet<E> createConcurrentSkipListSet(SortedSet<E> set) {
    if (set == null) {
        return new ConcurrentSkipListSet<E>();
    }// w w  w. ja  v  a  2s  .  c  om

    return new ConcurrentSkipListSet<E>(set);
}

From source file:se.sawano.java.security.otp.infrastructure.InMemTOTPRegistry.java

private ConcurrentSkipListSet<Entry> getConsumedTotpsFor(final UserId userId) {
    return store.computeIfAbsent(userId, id -> new ConcurrentSkipListSet<>());
}

From source file:lockstep.ServerReceivingQueue.java

/**
 * Constructor.//from w ww .j a  v  a2 s.  c o  m
 * 
 * @param initialFrameNumber First frame's number. Must be the same for all 
 * the hosts using the protocol
 * 
 * @param senderID ID of the client whose frames are collected in this queue
 * 
 * @param serverExecutionSemaphore semaphore used by to signal the client of
 * the availability of the next frame input. The client awaits that all the 
 * queues are ready before collecting the next frame inputs
 */
public ServerReceivingQueue(int initialFrameNumber, int senderID, Semaphore serverExecutionSemaphore) {
    this.senderID = senderID;

    this.commandBuffer = new ConcurrentSkipListMap<>();
    this.executionSemaphore = serverExecutionSemaphore;

    this.lastInOrderACK = new AtomicInteger(initialFrameNumber - 1);
    this.selectiveACKsSet = new ConcurrentSkipListSet<>();
}

From source file:lockstep.ClientReceivingQueue.java

/**
* Constructor./*from  w  ww. j  a  v a 2 s .com*/
* 
* @param initialFrameNumber First frame's number. Must be the same for all 
* the hosts using the protocol
* 
* @param senderID ID of the client whose frames are collected in this queue
* 
* @param clientExecutionSemaphore semaphore used by to signal the client of
* the availability of the next frame input. The client awaits that all the 
* queues are ready before collecting the next frame inputs
*/
public ClientReceivingQueue(int initialFrameNumber, int senderID, Semaphore clientExecutionSemaphore) {
    this.senderID = senderID;

    this.nextFrame = new AtomicInteger(initialFrameNumber);
    this.commandBuffer = new ConcurrentSkipListMap<>();
    this.executionSemaphore = clientExecutionSemaphore;

    this.lastInOrderACK = new AtomicInteger(initialFrameNumber - 1);
    this.selectiveACKsSet = new ConcurrentSkipListSet<>();
}

From source file:org.janusgraph.TestByteBuffer.java

private static long testByte() {
    LongObjectMap<ConcurrentSkipListSet<ByteEntry>> tx = new LongObjectHashMap<ConcurrentSkipListSet<ByteEntry>>(
            NUM);//from   w w w. j a v a 2 s . co m
    for (int i = 0; i < NUM; i++) {
        tx.put(i, new ConcurrentSkipListSet<ByteEntry>());
    }
    for (int i = 0; i < NUM; i++) {
        for (int j = 0; j < NUM; j++) {
            if (i == j)
                continue;
            if (Math.random() < FRACTION) {
                ByteBuffer key = ByteBuffer.allocate(16);
                key.putLong(5).putLong(j).flip();
                ByteBuffer value = ByteBuffer.allocate(4);
                value.putInt(random.nextInt(ROUNDSIZE)).flip();
                tx.get(i).add(new ByteEntry(key, value));
            }
        }
    }
    long time = System.currentTimeMillis();
    long sum = 0;
    for (int t = 0; t < TRIALS; t++) {
        for (int i = 0; i < NUM; i++) {
            for (Vertex v : (new ByteVertex(i, tx)).getNeighbors(0)) {
                sum += v.getId();
            }
        }
    }
    time = System.currentTimeMillis() - time;
    return time;
}