/** from
时代Java - N o w J a v a . c o m**/
//package com.nowjava;
import java.util.Collections;
import java.util.HashSet;
import java.util.Set;
public class Main {
public static void main(String[] argv) {
System.out.println(synchronizedSet());
}
/**
* Constructs a new synchronized {@code Set} based on a {@link HashSet}.
*
* @return a synchronized Set
*/
public static <T> Set<T> synchronizedSet() {
return Collections.synchronizedSet(new HashSet<T>());
}
/**
* Constructs a new synchronized {@code Set} based on a {@link HashSet} with
* the specified {@code initialCapacity}.
*
* @param initialCapacity
* the initial capacity of the set
*
* @return a synchronized Set
*/
/**代码未完, 请加载全部代码(NowJava.com).**/
本文系作者在时代Java发表,未经许可,不得转载。如有侵权,请联系nowjava@qq.com删除。