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
Contextual code suggestions in your IDE  Get Codota for Java
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 
6
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
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();
    } 
 
6
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
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) {
6
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
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
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:containsKey, get, put
 
    private static final Logger logger = LoggerFactory.getLogger(I18n.class); 
    private static final ConcurrentSkipListMap<String,I18n> translations;
 
    static { 
	translations = new ConcurrentSkipListMap<>();
	// preload important components 
	getTranslation("ifd"); 
	getTranslation("sal"); 
    } 
 
    /** 
     * Load a translation for the specified component. 
     * If no translation for a component exists, a fallback method is used according to {@link java.util.ResourceBundle} 
     * and in case no translation exists at all, an empty I18n instance is returned. 
     * <p>This method uses the I18n class as a reference to find resources.</p> 
     * 
     * @param component String describing the component. This must also be the filename prefix of the translation. 
     * @return I18n instance responsible for specified component. 
     * @see #getTranslation(java.lang.Class, java.lang.String) 

6
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:put
        T oldValue = getPartition(partitionName).putIfAbsent(key, value);
        if (oldValue != null)
        { 
            throw new ObjectAlreadyExistsException(); 
        } 
        getExpirtyInfoPartition(partitionName).put(Long.valueOf(System.nanoTime()), key);
    } 
 
    @Override 
    public T retrieve(Serializable key, String partitionName) throws ObjectStoreException
    { 
        T value = getPartition(partitionName).get(key);
        if (value == null)
        { 
            throw new ObjectDoesNotExistException(); 
        } 
        return value;
    } 
 
    @Override 

6
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:
 
		headMap.clear();
	} 
 
	private static final ConcurrentNavigableMap<Long, String> _tokens =
		new ConcurrentSkipListMap<Long, String>();
 
} 
6
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:put
 
    @Test
    public void testBase64Encoding() { 
        if (m_runTests == false) return;
 
        final Map<String, Object> m = new ConcurrentSkipListMap<String, Object>();
        m.put("basic-authentication", "Aladdin:open sesame"); 
        assertEquals("QWxhZGRpbjpvcGVuIHNlc2FtZQ==", HttpMonitor.determineBasicAuthentication(m)); 
        assertFalse( "QWxhZGRpbjpvcZVuIHNlc2FtZQ==".equals(HttpMonitor.determineBasicAuthentication(m)));
    } 
 
    @Test
    @JUnitHttpServer(basicAuth=true) 
    public void testBasicAuthentication() throws UnknownHostException {
        callTestBasicAuthentication(false); 
    } 
 
    @Test
    @JUnitHttpServer(basicAuth=true) 
    public void testBasicAuthenticationIPv6() throws UnknownHostException {
6
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:put
 
    @Test 
    @Ignore("This operation is not supported yet, see http://issues.opennms.org/browse/NMS-2963") 
    @JUnitHttpServer(port=10342, basicAuth=true) 
    public void testHttpBasicAuth() throws UnknownHostException { 
        Map<String, Object> m = new ConcurrentSkipListMap<String, Object>(); 
        Parameter p = new Parameter(); 
 
        HttpPlugin plugin = new HttpPlugin(); 
 
        p.setKey("port"); 
        p.setValue("10342"); 
        m.put(p.getKey(), p.getValue()); 
 
        p.setKey("retry"); 
        p.setValue("1"); 
        m.put(p.getKey(), p.getValue()); 
 
        p.setKey("timeout"); 
        p.setValue("3000"); 

6
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
See Code Examples for Java 8 ConcurrentSkipListMap Methods: