當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。