本文整理匯總了Java中java.util.Collections.unmodifiableCollection方法的典型用法代碼示例。如果您正苦於以下問題:Java Collections.unmodifiableCollection方法的具體用法?Java Collections.unmodifiableCollection怎麽用?Java Collections.unmodifiableCollection使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類java.util.Collections
的用法示例。
在下文中一共展示了Collections.unmodifiableCollection方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: getTransactions
import java.util.Collections; //導入方法依賴的package包/類
@ApiModelProperty(
access = "public",
name = "transactions",
value = "the transactions that have taken place for the account.")
public Collection<TransactionRepresentation> getTransactions() {
if (transactions == null) {
return null;
} else {
return Collections.unmodifiableCollection(transactions);
}
}
示例2: listNetworkInterfaceIPConfigurations
import java.util.Collections; //導入方法依賴的package包/類
@Override
public Collection<NicIPConfiguration> listNetworkInterfaceIPConfigurations() {
Collection<NicIPConfiguration> ipConfigs = new ArrayList<>();
Map<String, NetworkInterface> nics = new TreeMap<>();
List<IPConfigurationInner> ipConfigRefs = this.inner().ipConfigurations();
if (ipConfigRefs == null) {
return ipConfigs;
}
for (IPConfigurationInner ipConfigRef : ipConfigRefs) {
String nicID = ResourceUtils.parentResourceIdFromResourceId(ipConfigRef.id());
String ipConfigName = ResourceUtils.nameFromResourceId(ipConfigRef.id());
// Check if NIC already cached
NetworkInterface nic = nics.get(nicID.toLowerCase());
if (nic == null) {
// NIC not previously found, so ask Azure for it
nic = this.parent().manager().networkInterfaces().getById(nicID);
}
if (nic == null) {
// NIC doesn't exist so ignore this bad reference
continue;
}
// Cache the NIC
nics.put(nic.id().toLowerCase(), nic);
// Get the IP config
NicIPConfiguration ipConfig = nic.ipConfigurations().get(ipConfigName);
if (ipConfig == null) {
// IP config not found, so ignore this bad reference
continue;
}
ipConfigs.add(ipConfig);
}
return Collections.unmodifiableCollection(ipConfigs);
}
示例3: getCurrentSourceRootsForClasspath
import java.util.Collections; //導入方法依賴的package包/類
/**
* Finds source roots corresponding to the apparently active classpath
* (as reported by logging from Ant when it runs the Java launcher with -cp).
*/
private static Collection<FileObject> getCurrentSourceRootsForClasspath(SessionData data) {
if (data.classpath == null &&
data.modulepath == null &&
data.upgradeModulepath == null) {
return Collections.emptySet();
}
Collection<FileObject> result;
synchronized (data) {
result = data.searchSourceRoots;
}
if (result == null) {
result = new LinkedHashSet<>();
addPath(data.classpath, result, false);
addPath(data.modulepath, result, true);
addPath(data.upgradeModulepath, result, true);
if (data.platformSources != null) {
result.addAll(Arrays.asList(data.platformSources.getRoots()));
} else {
// no platform found. use default one:
JavaPlatform plat = JavaPlatform.getDefault();
// in unit tests the default platform may be null:
if (plat != null) {
result.addAll(Arrays.asList(plat.getSourceFolders().getRoots()));
}
}
result = Collections.unmodifiableCollection(result);
synchronized (data) {
data.searchSourceRoots = result;
}
}
return result;
}
示例4: jsonNodeToAllocationPools
import java.util.Collections; //導入方法依賴的package包/類
/**
* Changes JsonNode alocPools to a collection of the alocPools.
*
* @param allocationPools the allocationPools JsonNode
* @return a collection of allocationPools
*/
public Iterable<AllocationPool> jsonNodeToAllocationPools(JsonNode allocationPools) {
checkNotNull(allocationPools, JSON_NOT_NULL);
ConcurrentMap<Integer, AllocationPool> alocplMaps = Maps
.newConcurrentMap();
Integer i = 0;
for (JsonNode node : allocationPools) {
IpAddress startIp = IpAddress.valueOf(node.get("start").asText());
IpAddress endIp = IpAddress.valueOf(node.get("end").asText());
AllocationPool alocPls = new DefaultAllocationPool(startIp, endIp);
alocplMaps.putIfAbsent(i, alocPls);
i++;
}
return Collections.unmodifiableCollection(alocplMaps.values());
}
示例5: getMethodNames
import java.util.Collections; //導入方法依賴的package包/類
@Override
@NonNull
public Collection<? extends String> getMethodNames(
final @NonNull String clz,
final boolean rt,
final @NullAllowed String returnType,
final @NullAllowed String... parameterTypes) throws QueryException {
final List<? extends ExecutableElement> methods = getMethods(clz, null, rt, returnType, parameterTypes);
final List<String> result = new ArrayList<String>(methods.size());
for (ExecutableElement method : methods) {
result.add(method.getSimpleName().toString());
}
return Collections.unmodifiableCollection(result);
}
示例6: getSubnets
import java.util.Collections; //導入方法依賴的package包/類
@Override
public Iterable<Subnet> getSubnets() {
return Collections.unmodifiableCollection(subnetStore.values());
}
示例7: getPropertyKeys
import java.util.Collections; //導入方法依賴的package包/類
public Collection<String> getPropertyKeys() {
return Collections.unmodifiableCollection(properties.keySet());
}
示例8: getTextBound
import java.util.Collections; //導入方法依賴的package包/類
public Collection<TextBound> getTextBound() {
return Collections.unmodifiableCollection(textBound);
}
示例9: getProperties
import java.util.Collections; //導入方法依賴的package包/類
public synchronized Collection<Property> getProperties() {
Property[] properties = getSheet().get(Sheet.PROPERTIES).getProperties();
return Collections.unmodifiableCollection(Arrays.asList(properties));
}
示例10: getAnnotationSchemas
import java.util.Collections; //導入方法依賴的package包/類
public Collection<AnnotationSchema> getAnnotationSchemas() {
return Collections.unmodifiableCollection(annotationSchemas.values());
}
示例11: getViolations
import java.util.Collections; //導入方法依賴的package包/類
Collection<Violation> getViolations() {
return Collections.unmodifiableCollection(violations);
}
示例12: getFloatingIps
import java.util.Collections; //導入方法依賴的package包/類
@Override
public Collection<FloatingIp> getFloatingIps() {
return Collections.unmodifiableCollection(floatingIpStore.values());
}
示例13: removeMessages
import java.util.Collections; //導入方法依賴的package包/類
public Collection removeMessages() {
Collection result = Collections.unmodifiableCollection(messages);
messages.clear();
return result;
}
示例14: getSnakes
import java.util.Collections; //導入方法依賴的package包/類
protected static Collection<Snake> getSnakes() {
return Collections.unmodifiableCollection(snakes.values());
}
示例15: getConsumers
import java.util.Collections; //導入方法依賴的package包/類
public final Collection<Consumer<U>> getConsumers() {
return (Collections.unmodifiableCollection(this.consumers));
}