Example usage for java.util.concurrent ConcurrentHashMap newKeySet

List of usage examples for java.util.concurrent ConcurrentHashMap newKeySet

Introduction

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

Prototype

public static <K> KeySetView<K, Boolean> newKeySet() 

Source Link

Document

Creates a new Set backed by a ConcurrentHashMap from the given type to Boolean.TRUE .

Usage

From source file:ubicrypt.core.Utils.java

public static <T> Set<T> copySynchronized(final Set<T> set) {
    final Set<T> ret = ConcurrentHashMap.newKeySet();
    ret.addAll(set);/*w  ww  .  j  a  va2 s . c o  m*/
    return ret;
}

From source file:uk.gov.gchq.koryphe.serialisation.json.SimpleClassNameCache.java

private static Set<Class> createParentClasses() {
    final Set<Class> newParentClasses = ConcurrentHashMap.newKeySet();
    newParentClasses.addAll(DEFAULT_PARENT_CLASSES);
    for (final Class clazz : ReflectionUtil.getAnnotatedTypes(JsonSimpleClassName.class)) {
        final JsonSimpleClassName anno = (JsonSimpleClassName) clazz.getAnnotation(JsonSimpleClassName.class);
        if (null != anno) {
            if (anno.includeSubtypes()) {
                newParentClasses.add(clazz);
            }/* w  w  w  .jav  a2  s  .  c om*/
        }
    }

    return newParentClasses;
}