Example usage for com.google.common.collect Sets newSetFromMap

List of usage examples for com.google.common.collect Sets newSetFromMap

Introduction

In this page you can find the example usage for com.google.common.collect Sets newSetFromMap.

Prototype

@Deprecated
public static <E> Set<E> newSetFromMap(Map<E, Boolean> map) 

Source Link

Document

Returns a set backed by the specified map.

Usage

From source file:org.jboss.weld.util.collections.ConcurrentHashSetSupplier.java

@Override
public Set<T> get() {
    return Sets.newSetFromMap(new ConcurrentHashMap<T, Boolean>());
}

From source file:org.jboss.weld.bootstrap.BeanDeployerEnvironmentFactory.java

/**
 * Creates a new threadsafe BeanDeployerEnvironment instance. These instances are used by {@link ConcurrentBeanDeployer} during bootstrap.
 *//*from  w w w  .j av a  2  s .c  o  m*/
public static BeanDeployerEnvironment newConcurrentEnvironment(EjbDescriptors ejbDescriptors,
        BeanManagerImpl manager) {
    return new BeanDeployerEnvironment(
            Sets.newSetFromMap(new ConcurrentHashMap<SlimAnnotatedTypeContext<?>, Boolean>()),
            Sets.newSetFromMap(new ConcurrentHashMap<Class<?>, Boolean>()),
            Multimaps.<Class<?>, AbstractClassBean<?>>newConcurrentSetMultimap(),
            Sets.newSetFromMap(new ConcurrentHashMap<ProducerField<?, ?>, Boolean>()),
            Multimaps.<WeldMethodKey, ProducerMethod<?, ?>>newConcurrentSetMultimap(),
            Sets.newSetFromMap(new ConcurrentHashMap<RIBean<?>, Boolean>()),
            Sets.newSetFromMap(new ConcurrentHashMap<ObserverInitializationContext<?, ?>, Boolean>()),
            Sets.newSetFromMap(new ConcurrentHashMap<DisposalMethod<?, ?>, Boolean>()),
            Sets.newSetFromMap(new ConcurrentHashMap<DisposalMethod<?, ?>, Boolean>()),
            Sets.newSetFromMap(new ConcurrentHashMap<DecoratorImpl<?>, Boolean>()),
            Sets.newSetFromMap(new ConcurrentHashMap<InterceptorImpl<?>, Boolean>()), ejbDescriptors,
            Sets.newSetFromMap(new ConcurrentHashMap<EnhancedAnnotatedType<?>, Boolean>()),
            new ConcurrentHashMap<InternalEjbDescriptor<?>, EnhancedAnnotatedType<?>>(), manager);
}

From source file:org.elasticsearch.common.util.concurrent.ConcurrentCollections.java

public static <V> Set<V> newConcurrentSet() {
    return Sets.newSetFromMap(ConcurrentCollections.<V, Boolean>newConcurrentMap());
}

From source file:org.getspout.spout.netcache.ChunkNetCache.java

public ChunkNetCache() {
    this(Sets.newSetFromMap(new ConcurrentHashMap<Long, Boolean>()));
}

From source file:org.eclipse.emf.compare.ide.utils.StorageURIConverter.java

/**
 * Constructs our uri converter given its delegate.
 * /*  w  ww  .j a  v a  2s . c o m*/
 * @param delegate
 *            The delegate URI Converter.
 */
public StorageURIConverter(URIConverter delegate) {
    super(delegate);
    this.loadedRevisions = Sets.newSetFromMap(new ConcurrentHashMap<IStorage, Boolean>());
}

From source file:de.cosmocode.palava.scope.SingletonUnitOfWorkScope.java

SingletonUnitOfWorkScope() {
    // weak keys is ok, the singleton scope is keeping the reference
    final ConcurrentMap<Object, Boolean> map = new MapMaker().weakKeys().evictionListener(this).makeMap();
    this.context = Sets.newSetFromMap(map);
}

From source file:net.jmhertlein.adminbuddy.daemon.DaemonCore.java

public DaemonCore() {
    this.sessions = Sets.newSetFromMap(new ConcurrentHashMap<ClientSession, Boolean>());
    pendingKeyAssociationTokens = new HashMap<>();
}

From source file:com.leacox.dagger.servlet.ManagedServletPipeline.java

public void init(ServletContext servletContext, ObjectGraph objectGraph) throws ServletException {
    Set<HttpServlet> initializedSoFar = Sets.newSetFromMap(Maps.<HttpServlet, Boolean>newIdentityHashMap());

    for (ServletDefinition servletDefinition : servletDefinitions) {
        servletDefinition.init(servletContext, objectGraph, initializedSoFar);
    }/*from  w ww .  j ava  2  s .c o m*/
}

From source file:org.onosproject.incubator.component.impl.ComponentManager.java

@Activate
private void activate() {
    components = Sets.newSetFromMap(new ConcurrentHashMap<>());

    executor = Executors.newScheduledThreadPool(NUM_THREADS, groupedThreads("onos/component", "%d", log));

    executor.scheduleAtFixedRate(() -> components.forEach(this::enableComponent), 0, POLLING_PERIOD_MS,
            TimeUnit.MILLISECONDS);

    log.info("Started");
}

From source file:net.myrrix.web.DoSFilter.java

public DoSFilter() {
    numRecentAccesses = Maps.newConcurrentMap();
    bannedIPAddresses = Sets.newSetFromMap(Maps.<String, Boolean>newConcurrentMap());
}