本文整理汇总了Java中com.google.common.collect.Sets.newSetFromMap方法的典型用法代码示例。如果您正苦于以下问题:Java Sets.newSetFromMap方法的具体用法?Java Sets.newSetFromMap怎么用?Java Sets.newSetFromMap使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.google.common.collect.Sets
的用法示例。
在下文中一共展示了Sets.newSetFromMap方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: activate
import com.google.common.collect.Sets; //导入方法依赖的package包/类
@Activate
private void activate() {
components = Sets.newSetFromMap(new ConcurrentHashMap<>());
executor = Executors.newScheduledThreadPool(NUM_THREADS,
groupedThreads("onos/component", "%d"));
executor.scheduleAtFixedRate(() -> components.forEach(this::enableComponent),
0, POLLING_PERIOD_MS, TimeUnit.MILLISECONDS);
log.info("Started");
}
示例2: newCaseInsensitiveSet
import com.google.common.collect.Sets; //导入方法依赖的package包/类
public static Set<String> newCaseInsensitiveSet() {
return Sets.newSetFromMap(new CaseInsensitiveMap<Boolean>());
}
示例3: newConcurrentSet
import com.google.common.collect.Sets; //导入方法依赖的package包/类
public static <V> Set<V> newConcurrentSet() {
return Sets.newSetFromMap(ConcurrentCollections.<V, Boolean>newConcurrentMap());
}
示例4: newCaseInsensitiveSet
import com.google.common.collect.Sets; //导入方法依赖的package包/类
@SuppressWarnings("deprecation")
public static Set<String> newCaseInsensitiveSet() {
return Sets.newSetFromMap(new CaseInsensitiveMap<Boolean>());
}
示例5: newConcurrentHashSet
import com.google.common.collect.Sets; //导入方法依赖的package包/类
/**
* Creates a thread-safe set backed by a hash map. The set is backed by a
* {@link ConcurrentHashMap} instance, and thus carries the same concurrency
* guarantees.
*
* <p>Unlike {@code HashSet}, this class does NOT allow {@code null} to be
* used as an element. The set is serializable.
*
* @return a new, empty thread-safe {@code Set}
* @since 15.0
*/
public static <E> Set<E> newConcurrentHashSet() {
return Sets.newSetFromMap(new ConcurrentHashMap<E, Boolean>());
}