java.util.Collections#unmodifiableCollection ( )源码实例Demo

下面列出了java.util.Collections#unmodifiableCollection ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: javaide   文件: Paths.java
Collection<File> otherSearchPath() {
    if (otherSearchPath == null) {
        lazy();
        Path userClassPath = getPathForLocation(CLASS_PATH);
        Path sourcePath = getPathForLocation(SOURCE_PATH);
        if (sourcePath == null)
            otherSearchPath = userClassPath;
        else {
            otherSearchPath = new Path();
            otherSearchPath.addAll(userClassPath);
            otherSearchPath.addAll(sourcePath);
        }
    }
    return Collections.unmodifiableCollection(otherSearchPath);
}
 
源代码2 项目: Javacord   文件: RoleImpl.java
@Override
public Collection<User> getUsers() {
    if (isEveryoneRole()) {
        return getServer().getMembers();
    }

    userHashSetLock.readLock().lock();
    try {
        return Collections.unmodifiableCollection(new ArrayList<>(users));
    } finally {
        userHashSetLock.readLock().unlock();
    }
}
 
源代码3 项目: linq   文件: WhereTest.java
@Test
void Where_IReadOnlyCollection_ReturnsExpectedValues_True() {
    Collection<Integer> source = Collections.unmodifiableCollection(Arrays.asList(1, 2, 3, 4, 5));
    Predicate1<Integer> truePredicate = (value) -> true;

    IEnumerable<Integer> result = Linq.of(source).where(truePredicate);

    assertEquals(source.size(), result.count());
    for (int i = 0; i < source.size(); i++) {
        assertEquals(Linq.of(source).elementAt(i), result.elementAt(i));
    }
}
 
源代码4 项目: codebuff   文件: Multimaps.java
/**
 * Returns an unmodifiable view of the specified collection, preserving the
 * interface for instances of {@code SortedSet}, {@code Set}, {@code List} and
 * {@code Collection}, in that order of preference.
 *
 * @param collection the collection for which to return an unmodifiable view
 * @return an unmodifiable view of the collection
 */

private static <V> Collection<V> unmodifiableValueCollection(Collection<V> collection) {
  if (collection instanceof SortedSet) {
    return Collections.unmodifiableSortedSet((SortedSet<V>) collection);
  } else if (collection instanceof Set) {
    return Collections.unmodifiableSet((Set<V>) collection);
  } else if (collection instanceof List) {
    return Collections.unmodifiableList((List<V>) collection);
  }
  return Collections.unmodifiableCollection(collection);
}
 
@Override
public Collection<ServerFeature> getOldServerFeatures() {
    return Collections.unmodifiableCollection(new HashSet<>(oldServerFeature));
}
 
源代码6 项目: netbeans   文件: LoopOnlyKeywordsUnhandledError.java
public Collection<VerificationError> getErrors() {
    return Collections.unmodifiableCollection(errors);
}
 
源代码7 项目: blackduck-alert   文件: ConfigurationFieldModel.java
public Collection<String> getFieldValues() {
    if (fieldValues != null) {
        return Collections.unmodifiableCollection(fieldValues);
    }
    return Collections.emptySet();
}
 
源代码8 项目: onos   文件: SimpleLinkStore.java
@Override
public Iterable<Link> getLinks() {
    return Collections.unmodifiableCollection(links.values());
}
 
源代码9 项目: rapidminer-studio   文件: ParameterType.java
public Collection<ParameterCondition> getConditions() {
	return Collections.unmodifiableCollection(conditions);
}
 
源代码10 项目: NBTEditor   文件: CustomItemContainer.java
public Collection<String> getGroups() {
	return Collections.unmodifiableCollection(_customItemsByGroup.keySet());
}
 
源代码11 项目: guacamole-client   文件: ConnectionDirectory.java
@Override
@Transactional
public Collection<Connection> getAll(Collection<String> identifiers) throws GuacamoleException {
    Collection<ModeledConnection> objects = connectionService.retrieveObjects(getCurrentUser(), identifiers);
    return Collections.<Connection>unmodifiableCollection(objects);
}
 
源代码12 项目: dubbox   文件: JdkCompiler.java
Collection<JavaFileObject> files() {
    return Collections.unmodifiableCollection(classes.values());
}
 
源代码13 项目: mybatis   文件: TypeHandlerRegistry.java
/**
 * @since 3.2.2
 */
public Collection<TypeHandler<?>> getTypeHandlers() {
  return Collections.unmodifiableCollection(ALL_TYPE_HANDLERS_MAP.values());
}
 
源代码14 项目: flink   文件: TestingSchedulingTopology.java
@Override
public Iterable<TestingSchedulingExecutionVertex> getVertices() {
	return Collections.unmodifiableCollection(schedulingExecutionVertices.values());
}
 
源代码15 项目: onos   文件: Highlights.java
/**
 * Returns the collection of host highlights.
 *
 * @return host highlights
 */
public Collection<HostHighlight> hosts() {
    return Collections.unmodifiableCollection(hosts.values());
}
 
/**
 * Returns an instance of a new builder.
 *
 * @param scopes OAuth scopes
 * @since 1.15
 */
public Builder(Collection<String> scopes) {
  this.scopes = Collections.unmodifiableCollection(scopes);
}
 
源代码17 项目: sql-layer   文件: AISValidationResults.java
/**
 * Gets all failures, if there were any.
 *
 * The collection will be unmodifiable and immutable; if it is not empty, subsequent invocations of this method
 * may all return same collection instance, but only as long as no additional failures are reported. If new
 * failures are reported, they and the previous will be in a new collection instance.
 * @return an unmodifiable, immutable collection of failures; will be empty if all validations passed.
 */
public Collection<AISValidationFailure> failures() {
    return Collections.unmodifiableCollection(failureList);
}
 
源代码18 项目: CQL   文件: Sketch.java
/**
 * Accessor for the set of views on this sketch.
 * 
 * @return Collection of the views on this sketch
 */
@Override
public Collection<ViewNode> getViews() {
	return Collections.unmodifiableCollection(_views.values());
}
 
源代码19 项目: SlidingIntroScreen   文件: IntroActivity.java
/**
 * Returns an unmodifiable Collection containing the pages.
 *
 * @return the pages of this activity
 */
public final Collection<Fragment> getPages() {
	return Collections.unmodifiableCollection(pages);
}
 
源代码20 项目: TencentKona-8   文件: Options.java
/**
 * Return the option templates for all the valid option supported.
 *
 * @return a collection of OptionTemplate objects.
 */
public static Collection<OptionTemplate> getValidOptions() {
    return Collections.unmodifiableCollection(validOptions);
}