Java 8 ConcurrentSkipListMap - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Java 8 ConcurrentSkipListMap class.

This code example shows how to use the following methods: put
    @After 
    public void tearDown() { 
    } 
 
    private ConcurrentSkipListMap<String, AbstractGraphRow> createTestModel() {
        ConcurrentSkipListMap<String, AbstractGraphRow> testModel = new ConcurrentSkipListMap<String, AbstractGraphRow>();
        Calendar now = Calendar.getInstance();
        now.set(Calendar.HOUR_OF_DAY, 10);
        now.set(Calendar.MINUTE, 30);
        now.set(Calendar.SECOND, 0);
        now.set(Calendar.MILLISECOND, 500);
 
        GraphRowAverages row1 = new GraphRowAverages();
        GraphRowAverages row2 = new GraphRowAverages();
        GraphRowAverages row3 = new GraphRowAverages();
 
        testModel.put("row1", row1);
        testModel.put("row2", row2);
        testModel.put("row3", row3);
 

7
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
This code example shows how to use the following methods:
   *          well as object equality in the map. 
   * @return a map that uses the passed comparator 
   */ 
  public static IndexKeyValueSkipListSet create(Comparator<KeyValue> comparator) {
    ConcurrentSkipListMap<KeyValue, KeyValue> delegate =
        new ConcurrentSkipListMap<KeyValue, KeyValue>(comparator);
    IndexKeyValueSkipListSet ret = new IndexKeyValueSkipListSet(delegate);
    return ret;
  } 
 
  /** 
   * @param delegate map to which to delegate all calls 
   */ 
  public IndexKeyValueSkipListSet(ConcurrentSkipListMap<KeyValue, KeyValue> delegate) {
    super(delegate);
    this.delegate = delegate;
  } 
 
  /** 
   * Add the passed {@link KeyValue} to the set, only if one is not already set. This is equivalent 
Full Snippet Info
6
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
This code example shows how to use the following methods: keySet, put, remove
        if (nextScaleTime.compareAndSet(next, now + RESCALE_THRESHOLD)) {
            lockForRescale(); 
            try { 
                final long oldStartTime = startTime;
                this.startTime = tick();
                final ArrayList<Double> keys = new ArrayList<Double>(values.keySet());
                for (Double key : keys) {
                    final Long value = values.remove(key);
                    values.put(key * exp(-alpha * (startTime - oldStartTime)), value);
                } 
            } finally { 
                unlockForRescale(); 
            } 
        } 
    } 
 
    private void unlockForRescale() { 
        lock.writeLock().unlock();
    } 
 
Full Snippet Info
6
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
This code example shows how to use the following methods: get, putIfAbsent
		return addRaw(o);
	} 
 
	private boolean addRaw(T o) {
		Long key = getKey(o.getPriority());
		RedirectableConcurrentLinkedQueue<T> queue = queueMap.get(key);
		if (queue == null) {
			queue = new RedirectableConcurrentLinkedQueue<>(key);
			RedirectableConcurrentLinkedQueue<T> previous = queueMap.putIfAbsent(key, queue);
			if (previous != null) {
				queue = previous;
			} 
		} 
		return queue.add(o);
	} 
 
	/** 
	 * Removes a prioritized element from the queue 
	 */ 
	public boolean remove(T o) {
Full Snippet Info
6
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
This code example shows how to use the following methods: put
    public void tearDown() { 
    } 
 
    private ConcurrentSkipListMap<String, AbstractGraphRow> createTestModel()
    { 
        ConcurrentSkipListMap<String, AbstractGraphRow> testModel = new ConcurrentSkipListMap<String, AbstractGraphRow>();
        Calendar now = Calendar.getInstance();
        now.set(Calendar.HOUR_OF_DAY, 10);
        now.set(Calendar.MINUTE, 30);
        now.set(Calendar.SECOND, 0);
        now.set(Calendar.MILLISECOND, 500);
 
        GraphRowAverages row1 = new GraphRowAverages();
        GraphRowAverages row2 = new GraphRowAverages();
        GraphRowAverages row3 = new GraphRowAverages();
 
        testModel.put("row1", row1);
        testModel.put("row2", row2);
        testModel.put("row3", row3);
 

6
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
See Code Examples for Java 8 ConcurrentSkipListMap Methods: