ConcurrentHashMap size - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for ConcurrentHashMap size method.

This code example shows how to use the following methods:size
     * Accessor to the number of StoreData in cache 
     * @return the number of StoreData in cache 
     */ 
    public int size() 
    { 
        return storeDataByClass.size();
    } 
 
    /** 
     * Begin a transaction that changes the StoreData cache 
     */ 
    public void begin() 
    { 
        savedStoreDataByClass = new ConcurrentHashMap<Object, StoreData>(storeDataByClass);
    } 
     
    /** 
     * Rollback the transaction changes to the StoreData cache 
     */ 
    public void rollback() 
7
CodeRank
This code example shows how to use the following methods:clear, putIfAbsent, size
     * @since 2.5 
     */ 
    public V putIfAbsent(K key, V value) {
        // not 100% optimal semantically, but better from correctness (never exceeds 
        // defined maximum) and close enough all in all: 
        if (_map.size() >= _maxEntries) {
            synchronized (this) {
                if (_map.size() >= _maxEntries) {
                    clear(); 
                } 
            } 
        } 
        return _map.putIfAbsent(key, value);
    } 
     
    // NOTE: key is of type Object only to retain binary backwards-compatibility 
    public V get(Object key) {  return _map.get(key); }
 
    public void clear() { _map.clear(); }
    public int size() { return _map.size(); }

6
CodeRank
This code example shows how to use the following methods:keys, size
	} 
 
	@Override 
	public String[] getValueNames()
	{ 
		return Collections.list(attributes.keys()).toArray(new String[attributes.size()]);
	} 
 
	@Override 
	public void setAttribute(String name, Object value)
	{ 
		attributes.put(name, value);
	} 
 
	@Override 
	public void putValue(String name, Object value)
	{ 
		attributes.put(name, value);
	} 
 
6
CodeRank
This code example shows how to use the following methods:size
    } 
 
 
    @Override 
    public int size() { 
        return this.map.size(); 
    } 
 
 
    @Override 
    public void close() throws IOException { 
        this.map.clear(); 
    } 
 
} 
5
CodeRank
This code example shows how to use the following methods:size
  /** 
   *  
   * @return number of metrics in the registry 
   */ 
  public int size() { 
    return metricsList.size(); 
  } 
   
  /** 
   * Add a new metrics to the registry 
   * @param metricsName - the name 
   * @param theMetricsObj - the metrics 
   * @throws IllegalArgumentException if a name is already registered 
   */ 
  public void add(final String metricsName, final MetricsBase theMetricsObj) { 
    if (metricsList.putIfAbsent(metricsName, theMetricsObj) != null) { 
      throw new IllegalArgumentException("Duplicate metricsName:" + 
          metricsName); 
    } 
  } 
5
CodeRank
This code example shows how to use the following methods:size
	 * Returns the number of elements in this set (its cardinality). 
	 *  
	 * @return the number of elements in this set (its cardinality) 
	 */ 
	public int size() { 
		return map.size(); 
	} 
 
	/** 
	 * Returns <tt>true</tt> if this set contains no elements. 
	 *  
	 * @return <tt>true</tt> if this set contains no elements 
	 */ 
	public boolean isEmpty() { 
		return map.isEmpty(); 
	} 
 
	/** 
	 * Returns <tt>true</tt> if this set contains the specified element. More 
	 * formally, returns <tt>true</tt> if and only if this set contains an 
5
CodeRank
This code example shows how to use the following methods:size
     
    // NOTE: key is of type Object only to retain binary backwards-compatibility 
    public V get(Object key) {  return _map.get(key); }
 
    public void clear() { _map.clear(); }
    public int size() { return _map.size(); }
 
    /* 
    /********************************************************** 
    /* Serializable overrides 
    /********************************************************** 
     */ 
 
    /** 
     * Ugly hack, to work through the requirement that _value is indeed final, 
     * and that JDK serialization won't call ctor(s) if Serializable is implemented. 
     *  
     * @since 2.1 
     */ 
    protected transient int _jdkSerializeMaxEntries;
5
CodeRank
This code example shows how to use the following methods:size
    } 
 
    @Override 
    public String toString()
    { 
        return String.format("%s [cache.count=%d]",this.getClass().getSimpleName(),cache.size());
    } 
} 
5
CodeRank
This code example shows how to use the following methods:size
   * Returns the number of NMTokens present in cache. 
   */ 
  @Private 
  @VisibleForTesting 
  public int numberOfTokensInCache() { 
    return nmTokens.size();
  } 
   
  /** 
   * Removes NMToken for specified node manager 
   * @param nodeAddr node address (host:port) 
   */ 
  @Private 
  @VisibleForTesting 
  public void removeToken(String nodeAddr) {
    nmTokens.remove(nodeAddr);
  } 
   
  /** 
   * It will remove all the nm tokens from its cache 
5
CodeRank
This code example shows how to use the following methods:size
	 * (non-Javadoc) 
	 *  
	 * @see org.mixare.mgr.downloader.DownloadManager#getResultSize() 
	 */ 
	public int getResultSize(){ 
		return doneList.size();
	} 
 
	/* 
	 * (non-Javadoc) 
	 *  
	 * @see org.mixare.mgr.downloader.DownloadManager#isDone() 
	 */ 
	public Boolean isDone() {
		return todoList.isEmpty();
	} 
 
	/* 
	 * (non-Javadoc) 
	 *  
5
CodeRank
size Method Overview
Returns the number of key-value mappings in this map.
See Code Examples for other Java 8 ConcurrentHashMap Methods: