本文整理汇总了Java中java.util.Collections.unmodifiableSet方法的典型用法代码示例。如果您正苦于以下问题:Java Collections.unmodifiableSet方法的具体用法?Java Collections.unmodifiableSet怎么用?Java Collections.unmodifiableSet使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类java.util.Collections
的用法示例。
在下文中一共展示了Collections.unmodifiableSet方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getBluetoothDeviceKnownSupportedServices
import java.util.Collections; //导入方法依赖的package包/类
public Set<BluetoothService> getBluetoothDeviceKnownSupportedServices() {
if (mServiceSet == null) {
synchronized (this) {
if (mServiceSet == null) {
final Set<BluetoothService> serviceSet = new HashSet<>();
for (final BluetoothService service : BluetoothService.values()) {
if (mDevice.getBluetoothClass().hasService(service.getAndroidConstant())) {
serviceSet.add(service);
}
}
mServiceSet = Collections.unmodifiableSet(serviceSet);
}
}
}
return mServiceSet;
}
示例2: getKeys
import java.util.Collections; //导入方法依赖的package包/类
public Collection<String> getKeys() {
// Using LinkedHashSet to preserve insertion order
Set<String> keys = new LinkedHashSet<String>();
IDataCursorResource cursorRes = newCursorResource();
try {
IDataCursor cursor = cursorRes.getCursor();
boolean hasMore = cursor.first();
while (hasMore) {
keys.add(cursor.getKey());
hasMore = cursor.next();
}
return Collections.unmodifiableSet(keys);
}
finally {
cursorRes.close();
}
}
示例3: getSubTypes
import java.util.Collections; //导入方法依赖的package包/类
/**
* Get implementations of a given class. The results are cached.
*
* @param clazz the class to get sub types of.
* @return the sub classes.
*/
public static Set<Class> getSubTypes(final Class<?> clazz) {
Set<Class> subClasses = subclassesCache.get(clazz);
if (null == subClasses) {
updateReflectionPackages();
final Set<Class> newSubClasses = new HashSet<>();
if (clazz.isInterface()) {
getScanner().matchClassesImplementing(clazz, c -> {
if (isPublicConcrete(c)) {
newSubClasses.add(c);
}
}).scan();
} else {
getScanner().matchSubclassesOf(clazz, c -> {
if (isPublicConcrete(c)) {
newSubClasses.add(c);
}
}).scan();
}
subClasses = Collections.unmodifiableSet(newSubClasses);
subclassesCache.put(clazz, subClasses);
}
return subClasses;
}
示例4: partiallyVisibleUserTopLevelTypes
import java.util.Collections; //导入方法依赖的package包/类
/** Returns every top-level user type that is itself visible or has a visible subtype.
* @param vizState
*/
static Set<AlloyType> partiallyVisibleUserTopLevelTypes(final VizState vizState) {
final AlloyModel model = vizState.getOriginalModel();
final Set<AlloyType> visibleUserTypes = visibleUserTypes(vizState);
//final Set<AlloyType> topLevelTypes = topLevelTypes(vizState);
final Set<AlloyType> result = new LinkedHashSet<AlloyType>();
for (final AlloyType t : visibleUserTypes) {
if (visibleUserTypes.contains(t)) {
result.add(model.getTopmostSuperType(t));
}
}
return Collections.unmodifiableSet(result);
}
示例5: getDependenciesPlainList
import java.util.Collections; //导入方法依赖的package包/类
@NotNull
@Override
public Set<HybrisModuleDescriptor> getDependenciesPlainList() {
return Collections.unmodifiableSet(this.recursivelyCollectDependenciesPlainSet(
this, new TreeSet<>()
));
}
开发者ID:AlexanderBartash,项目名称:hybris-integration-intellij-idea-plugin,代码行数:8,代码来源:AbstractHybrisModuleDescriptor.java
示例6: getImportedDocuments
import java.util.Collections; //导入方法依赖的package包/类
public Set<SchemaDocument> getImportedDocuments(String targetNamespace) {
if(targetNamespace==null)
throw new IllegalArgumentException();
Set<SchemaDocument> r = new HashSet<SchemaDocument>();
for (SchemaDocumentImpl doc : references) {
if(doc.getTargetNamespace().equals(targetNamespace))
r.add(doc);
}
return Collections.unmodifiableSet(r);
}
示例7: getDefaultAllowedConfigs
import java.util.Collections; //导入方法依赖的package包/类
@TargetApi(Build.VERSION_CODES.O)
private static Set<Bitmap.Config> getDefaultAllowedConfigs() {
Set<Bitmap.Config> configs = new HashSet<>();
configs.addAll(Arrays.asList(Bitmap.Config.values()));
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
// GIFs, among other types, end up with a native Bitmap config that doesn't map to a java
// config and is treated as null in java code. On KitKat+ these Bitmaps can be reconfigured
// and are suitable for re-use.
configs.add(null);
}
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
configs.remove(Bitmap.Config.HARDWARE);
}
return Collections.unmodifiableSet(configs);
}
示例8: entrySet
import java.util.Collections; //导入方法依赖的package包/类
@Override
public Set<Entry<String, Property>> entrySet() {
final HashSet<Entry<String, Property>> set = new HashSet<>();
for (Element element = list; element != null; element = element.getLink()) {
set.add(element);
}
return Collections.unmodifiableSet(set);
}
示例9: getAllLocalBucketRegions
import java.util.Collections; //导入方法依赖的package包/类
/**
* Returns a set of local buckets.
*
* @return an unmodifiable set of BucketRegion
*/
public Set<BucketRegion> getAllLocalBucketRegions() {
Set<BucketRegion> retVal = new HashSet<BucketRegion>();
for (BucketRegion br : localBucket2RegionMap.values()) {
retVal.add(br);
}
return Collections.unmodifiableSet(retVal);
}
示例10: availabilityZones
import java.util.Collections; //导入方法依赖的package包/类
@Override
public Set<AvailabilityZoneId> availabilityZones() {
Set<AvailabilityZoneId> zones = new HashSet<>();
if (this.inner().zones() != null) {
for (String zone : this.inner().zones()) {
zones.add(AvailabilityZoneId.fromString(zone));
}
}
return Collections.unmodifiableSet(zones);
}
示例11: getCanonicalFiles
import java.util.Collections; //导入方法依赖的package包/类
private static Set<File> getCanonicalFiles(String[] paths) {
Set<File> files = new HashSet<>(paths.length);
for (String root : paths) {
File rootFile = new File(root);
try {
rootFile = rootFile.getCanonicalFile();
} catch (IOException ioex) {}
files.add(rootFile);
}
return Collections.unmodifiableSet(files);
}
示例12: getSecurityRoles
import java.util.Collections; //导入方法依赖的package包/类
public Set<String> getSecurityRoles() {
return Collections.unmodifiableSet(securityRoles);
}
示例13: initOptionSets
import java.util.Collections; //导入方法依赖的package包/类
private static void initOptionSets() {
boolean flowsupported = ExtendedOptionsImpl.flowSupported();
// Socket
Set<SocketOption<?>> set = new HashSet<>();
set.add(StandardSocketOptions.SO_KEEPALIVE);
set.add(StandardSocketOptions.SO_SNDBUF);
set.add(StandardSocketOptions.SO_RCVBUF);
set.add(StandardSocketOptions.SO_REUSEADDR);
set.add(StandardSocketOptions.SO_LINGER);
set.add(StandardSocketOptions.IP_TOS);
set.add(StandardSocketOptions.TCP_NODELAY);
if (flowsupported) {
set.add(ExtendedSocketOptions.SO_FLOW_SLA);
}
set = Collections.unmodifiableSet(set);
options.put(Socket.class, set);
// ServerSocket
set = new HashSet<>();
set.add(StandardSocketOptions.SO_RCVBUF);
set.add(StandardSocketOptions.SO_REUSEADDR);
set.add(StandardSocketOptions.IP_TOS);
set = Collections.unmodifiableSet(set);
options.put(ServerSocket.class, set);
// DatagramSocket
set = new HashSet<>();
set.add(StandardSocketOptions.SO_SNDBUF);
set.add(StandardSocketOptions.SO_RCVBUF);
set.add(StandardSocketOptions.SO_REUSEADDR);
set.add(StandardSocketOptions.IP_TOS);
if (flowsupported) {
set.add(ExtendedSocketOptions.SO_FLOW_SLA);
}
set = Collections.unmodifiableSet(set);
options.put(DatagramSocket.class, set);
// MulticastSocket
set = new HashSet<>();
set.add(StandardSocketOptions.SO_SNDBUF);
set.add(StandardSocketOptions.SO_RCVBUF);
set.add(StandardSocketOptions.SO_REUSEADDR);
set.add(StandardSocketOptions.IP_TOS);
set.add(StandardSocketOptions.IP_MULTICAST_IF);
set.add(StandardSocketOptions.IP_MULTICAST_TTL);
set.add(StandardSocketOptions.IP_MULTICAST_LOOP);
if (flowsupported) {
set.add(ExtendedSocketOptions.SO_FLOW_SLA);
}
set = Collections.unmodifiableSet(set);
options.put(MulticastSocket.class, set);
}
示例14: getChannels
import java.util.Collections; //导入方法依赖的package包/类
public Set<Channel> getChannels(){
return Collections.unmodifiableSet(channels);
}
示例15: getApplications
import java.util.Collections; //导入方法依赖的package包/类
public Set<String> getApplications() {
return Collections.unmodifiableSet(applications);
}