当前位置: 首页>>代码示例>>Java>>正文


Java Collections.unmodifiableSet方法代码示例

本文整理汇总了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;
}
 
开发者ID:Twelvelines,项目名称:AndroidMuseumBleManager,代码行数:19,代码来源:BluetoothLeDevice.java

示例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();
		}
	}
 
开发者ID:innodev-au,项目名称:wmboost-data,代码行数:21,代码来源:DocumentImpl.java

示例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;
}
 
开发者ID:gchq,项目名称:koryphe,代码行数:32,代码来源:ReflectionUtil.java

示例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);
}
 
开发者ID:ModelWriter,项目名称:Tarski,代码行数:19,代码来源:MagicUtil.java

示例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);
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:11,代码来源:SchemaDocumentImpl.java

示例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);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:16,代码来源:LruBitmapPool.java

示例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);
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:9,代码来源:PropertyHashMap.java

示例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);
}
 
开发者ID:ampool,项目名称:monarch,代码行数:13,代码来源:PartitionedRegionDataStore.java

示例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);
}
 
开发者ID:Azure,项目名称:azure-libraries-for-java,代码行数:11,代码来源:DiskImpl.java

示例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);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:12,代码来源:SourceRootsCache.java

示例12: getSecurityRoles

import java.util.Collections; //导入方法依赖的package包/类
public Set<String> getSecurityRoles() {
    return Collections.unmodifiableSet(securityRoles);
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:4,代码来源:DeploymentInfo.java

示例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);
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:58,代码来源:Sockets.java

示例14: getChannels

import java.util.Collections; //导入方法依赖的package包/类
public Set<Channel> getChannels(){
    return Collections.unmodifiableSet(channels);
}
 
开发者ID:yunhaibin,项目名称:dubbox-hystrix,代码行数:4,代码来源:MockedChannelHandler.java

示例15: getApplications

import java.util.Collections; //导入方法依赖的package包/类
public Set<String> getApplications() {
    return Collections.unmodifiableSet(applications);
}
 
开发者ID:flychao88,项目名称:dubbocloud,代码行数:4,代码来源:RegistryContainer.java


注:本文中的java.util.Collections.unmodifiableSet方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。