ConcurrentHashMap keySet - 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 keySet method.

This code example shows how to use the following methods:get, isEmpty, keySet, remove
	 *  
	 * @see org.mixare.mgr.downloader.DownloadManager#getNextResult() 
	 */ 
	public synchronized DownloadResult getNextResult() { 
		DownloadResult result = null;
		if (!doneList.isEmpty()) {
			String nextId = doneList.keySet().iterator().next();
			result = doneList.get(nextId);
			doneList.remove(nextId);
		} 
		return result;
	} 
	 
	/* 
	 * (non-Javadoc) 
	 *  
	 * @see org.mixare.mgr.downloader.DownloadManager#getResultSize() 
	 */ 
	public int getResultSize(){ 
		return doneList.size();
7
CodeRank
This code example shows how to use the following methods:keySet
	 *             com.liferay.portal.repository.registry.RepositoryClassDefinitionCatalogUtil#getExternalRepositoryClassNames( 
	 *             )} 
	 */ 
	@Deprecated 
	public static String[] getExternalRepositoryClassNames() {
		Set<String> classNames = externalRepositoryFactories.keySet();
 
		return classNames.toArray(new String[classNames.size()]);
	} 
 
	public static BaseRepository getInstance(String className)
		throws Exception {
 
		ExternalRepositoryFactory externalRepositoryFactory =
			externalRepositoryFactories.get(className);
 
		BaseRepository baseRepository = null;
 
		if (externalRepositoryFactory != null) {
			baseRepository = externalRepositoryFactory.getInstance();
5
CodeRank
This code example shows how to use the following methods:get, keySet, remove
   * 
   * <p>This method is not atomic: the map may be visible in intermediate states, where some 
   * of the zero values have been removed and others have not. 
   */ 
  public void removeAllZeros() { 
    for (K key : map.keySet()) {
      AtomicLong atomic = map.get(key);
      if (atomic != null && atomic.get() == 0L) {
        map.remove(key, atomic);
      } 
    } 
  } 
 
  /** 
   * Returns the sum of all values in this map. 
   * 
   * <p>This method is not atomic: the sum may or may not include other concurrent operations. 
   */ 
  public long sum() { 
    long sum = 0L;
6
CodeRank
This code example shows how to use the following methods:keySet
 
        @Override 
        public Set<String> loadAllKeys() {
            // sleep to highlight asynchronous behavior 
            sleepMillis(MS_LOAD_DELAY);
            return store.keySet();
        } 
 
        @Override 
        public void store(String key, String value) {
            store.put(key, value);
        } 
 
        @Override 
        public void storeAll(Map<String, String> map) {
            store.putAll(map);
        } 
 
        @Override 
        public void delete(String key) {
5
CodeRank
This code example shows how to use the following methods:keySet
 
    /** 
     *  @return set of objects with counts > 0 
     */ 
    public Set<K> objects() {
        return this.map.keySet();
    } 
 
    /** 
     *  start over 
     *  @since 0.7.11 
     */ 
    public void clear() { 
        this.map.clear();
    } 
} 
 
5
CodeRank
This code example shows how to use the following methods:keySet
        return _name;
    } 
     
    @Override 
    public Collection<String> getWaiters() {
        return _asleep.keySet();
    } 
     
    @Override 
    public boolean wakeup(String threadName) {
        Thread th = _asleep.get(threadName);
        if (th != null) {
            th.interrupt();
            return true; 
        } 
         
        return false; 
    } 
 
    @Override 
5
CodeRank
This code example shows how to use the following methods:keySet
    } 
 
 
    @Override 
    public Iterator<BytesKey> keyIterator() { 
        return this.map.keySet().iterator(); 
    } 
 
 
    @Override 
    public void put(final BytesKey key, final OpItem opItem) { 
        this.map.put(key, opItem); 
    } 
 
 
    @Override 
    public void putAll(final Map<BytesKey, OpItem> map) { 
        this.map.putAll(map); 
    } 
 
5
CodeRank
This code example shows how to use the following methods:keySet
  /** 
   *  
   * @return the list of metrics names 
   */ 
  public Collection<String> getKeyList() { 
    return metricsList.keySet(); 
  } 
   
  /** 
   *  
   * @return the list of metrics 
   */ 
  public Collection<MetricsBase> getMetricsList() { 
    return metricsList.values(); 
  } 
} 
5
CodeRank
This code example shows how to use the following methods:keySet
	 *  
	 * @return an Iterator over the elements in this set 
	 * @see ConcurrentModificationException 
	 */ 
	public Iterator<E> iterator() { 
		return map.keySet().iterator(); 
	} 
 
	/** 
	 * 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. 
	 *  
5
CodeRank
This code example shows how to use the following methods:keySet
     * ·µ»ØÊôÐÔµÄkey¼¯ºÏ£¬ÈõÒ»ÖÂÐÔ 
     *  
     * @return 
     */ 
    public Set<String> attributeKeySet() {
        return this.attributes.keySet();
    } 
 
 
    /** 
     * ÒƳýkeyÖ¸¶¨µÄÊôÐÔ 
     *  
     * @param key 
     * @return 
     */ 
    public Object removeAttribute(final String key) {
        return this.attributes.remove(key);
    } 
 
 
5
CodeRank
keySet Method Overview
Returns a Set view of the keys contained in this map.
See Code Examples for other Java 8 ConcurrentHashMap Methods: