本文整理了Java中java.util.Collections.unmodifiableCollection()
方法的一些代码示例,展示了Collections.unmodifiableCollection()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Collections.unmodifiableCollection()
方法的具体详情如下:
包路径:java.util.Collections
类名称:Collections
方法名:unmodifiableCollection
[英]Returns a wrapper on the specified collection which throws an UnsupportedOperationException whenever an attempt is made to modify the collection.
[中]返回指定集合上的包装器,每当尝试修改集合时,该包装器都会引发UnsupportdOperationException。
代码示例来源:origin: spring-projects/spring-framework
/**
* Return the managed {@link MessageListenerContainer} instance(s).
*/
public Collection<MessageListenerContainer> getListenerContainers() {
return Collections.unmodifiableCollection(this.listenerContainers.values());
}
代码示例来源:origin: baomidou/mybatis-plus
/**
* 使用自己的 knownMappers
*/
@Override
public Collection<Class<?>> getMappers() {
return Collections.unmodifiableCollection(knownMappers.keySet());
}
}
代码示例来源:origin: plantuml/plantuml
public Collection<GraphicalElement> getAllGraphicalElements() {
final Collection<GraphicalElement> result = new ArrayList<GraphicalElement>();
for (Event ev : eventsList) {
result.add(events.get(ev));
}
return Collections.unmodifiableCollection(result);
}
代码示例来源:origin: peter-lawrey/Java-Chronicle
public MapWrapper(@NotNull DataStore dataStore, String name, @NotNull Class<K> kClass, @NotNull Class<V> vClass, @NotNull Map<K, V> underlying, int maxMessageSize) {
this.dataStore = dataStore;
this.name = name;
this.kClass = kClass;
this.vClass = vClass;
this.underlying = underlying;
this.maxMessageSize = maxMessageSize;
kEnumClass = dataStore.enumeratedClass(kClass);
vEnumClass = dataStore.enumeratedClass(vClass);
keySet = Collections.unmodifiableSet(underlying.keySet());
values = Collections.unmodifiableCollection(underlying.values());
entrySet = Collections.unmodifiableSet(underlying.entrySet());
dataStore.add(name, this);
}
代码示例来源:origin: com.sun.xml.bind/jaxb-impl
@Override
public Collection<QName> getExpectedAttributes() {
final Collection<QName> expAttrs = new HashSet<QName>();
expAttrs.addAll(super.getExpectedAttributes());
expAttrs.add(XsiTypeQNAME);
return Collections.unmodifiableCollection(expAttrs);
}
}
代码示例来源:origin: apache/incubator-dubbo
/**
* Get all registries
*
* @return all registries
*/
public static Collection<Registry> getRegistries() {
return Collections.unmodifiableCollection(REGISTRIES.values());
}
代码示例来源:origin: jersey/jersey
@Override
public Collection<String> getPropertyNames() {
return Collections.unmodifiableCollection(store.keySet());
}
代码示例来源:origin: apache/ignite
/**
* Allowed method return types.
*
* @return List of class names or text comments.
*/
public static Collection<String> getAllowedMethodParameterTypes() {
Collection<String> types = new ArrayList<>(ALLOWED_MTD_PARAM_TYPES.length + 1);
for (Class<?> type : ALLOWED_MTD_PARAM_TYPES) {
types.add(type.getName());
}
types.add("Java Array");
return Collections.unmodifiableCollection(types);
}
代码示例来源:origin: plantuml/plantuml
public final Collection<IGroup> getGroups(boolean withRootGroup) {
if (withRootGroup == false) {
return entityFactory.getGroupsvalues();
}
final Collection<IGroup> result = new ArrayList<IGroup>();
result.add(getRootGroup());
result.addAll(entityFactory.getGroupsvalues());
return Collections.unmodifiableCollection(result);
}
代码示例来源:origin: apache/incubator-dubbo
/**
* Get all registries
*
* @return all registries
*/
public static Collection<Registry> getRegistries() {
return Collections.unmodifiableCollection(REGISTRIES.values());
}
代码示例来源:origin: jersey/jersey
@Override
public Collection<String> getPropertyNames() {
return Collections.unmodifiableCollection(store.keySet());
}
代码示例来源:origin: apache/ignite
/**
* Converts List of Cluster Nodes to HashSet of UUIDs wrapped as unmodifiable collection.
* @param assignmentPart Source assignment per partition.
* @return List of deduplicated collections if ClusterNode's ids.
*/
public default Collection<UUID> assignments2ids(List<ClusterNode> assignmentPart) {
Collection<UUID> partIds = U.newHashSet(assignmentPart.size());
for (ClusterNode node : assignmentPart)
partIds.add(node.id());
return Collections.unmodifiableCollection(partIds);
}
}
代码示例来源:origin: spring-projects/spring-framework
public Collection<Object> values() {
return Collections.unmodifiableCollection(this.headers.values());
}
代码示例来源:origin: jMonkeyEngine/jmonkeyengine
public Collection<String> getAnimClipsNames() {
return Collections.unmodifiableCollection(animClipMap.keySet());
}
代码示例来源:origin: plantuml/plantuml
final public Collection<IGroup> getChildrenGroups(IGroup parent) {
final Collection<IGroup> result = new ArrayList<IGroup>();
for (IGroup gg : getGroups(false)) {
if (gg.getParentContainer() == parent) {
result.add(gg);
}
}
return Collections.unmodifiableCollection(result);
}
代码示例来源:origin: apache/incubator-dubbo
public static Collection<Monitor> getMonitors() {
return Collections.unmodifiableCollection(MONITORS.values());
}
代码示例来源:origin: wildfly/wildfly
/**
* Iterate over the options in this map.
*
* @return an iterator over the options
*/
public Iterator<Option<?>> iterator() {
return Collections.unmodifiableCollection(value.keySet()).iterator();
}
代码示例来源:origin: plantuml/plantuml
public Collection<IGroup> getChildren() {
checkGroup();
final Collection<IGroup> result = new ArrayList<IGroup>();
for (IGroup g : entityFactory.getGroupsvalues()) {
if (g != this && g.getParentContainer() == this) {
result.add(g);
}
}
return Collections.unmodifiableCollection(result);
}
代码示例来源:origin: apache/incubator-dubbo
Collection<JavaFileObject> files() {
return Collections.unmodifiableCollection(classes.values());
}
代码示例来源:origin: plantuml/plantuml
public Collection<ANode> getNodes() {
return Collections.unmodifiableCollection(nodesCols.keySet());
}
内容来源于网络,如有侵权,请联系作者删除!