本文整理了Java中java.util.Collections.unmodifiableSortedSet()
方法的一些代码示例,展示了Collections.unmodifiableSortedSet()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Collections.unmodifiableSortedSet()
方法的具体详情如下:
包路径:java.util.Collections
类名称:Collections
方法名:unmodifiableSortedSet
[英]Returns a wrapper on the specified sorted set which throws an UnsupportedOperationException whenever an attempt is made to modify the sorted set.
[中]
代码示例来源:origin: google/guava
UnmodifiableNavigableSet(NavigableSet<E> delegate) {
this.delegate = checkNotNull(delegate);
this.unmodifiableDelegate = Collections.unmodifiableSortedSet(delegate);
}
代码示例来源:origin: google/guava
/**
* 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);
}
代码示例来源:origin: google/j2objc
UnmodifiableNavigableSet(NavigableSet<E> delegate) {
this.delegate = checkNotNull(delegate);
this.unmodifiableDelegate = Collections.unmodifiableSortedSet(delegate);
}
代码示例来源:origin: google/guava
@Override
<E> SortedSet<E> unmodifiableCollectionSubclass(Collection<E> collection) {
if (collection instanceof NavigableSet) {
return Sets.unmodifiableNavigableSet((NavigableSet<E>) collection);
} else {
return Collections.unmodifiableSortedSet((SortedSet<E>) collection);
}
}
代码示例来源:origin: google/guava
@Override
<E> Collection<E> unmodifiableCollectionSubclass(Collection<E> collection) {
if (collection instanceof NavigableSet) {
return Sets.unmodifiableNavigableSet((NavigableSet<E>) collection);
} else if (collection instanceof SortedSet) {
return Collections.unmodifiableSortedSet((SortedSet<E>) collection);
} else {
return Collections.unmodifiableSet((Set<E>) collection);
}
}
代码示例来源:origin: google/guava
@Override
<E> Collection<E> unmodifiableCollectionSubclass(Collection<E> collection) {
if (collection instanceof NavigableSet) {
return Sets.unmodifiableNavigableSet((NavigableSet<E>) collection);
} else if (collection instanceof SortedSet) {
return Collections.unmodifiableSortedSet((SortedSet<E>) collection);
} else if (collection instanceof Set) {
return Collections.unmodifiableSet((Set<E>) collection);
} else if (collection instanceof List) {
return Collections.unmodifiableList((List<E>) collection);
} else {
return Collections.unmodifiableCollection(collection);
}
}
代码示例来源:origin: alibaba/jstorm
/**
* Returns a set of the names of all the metrics in the registry.
*
* @return the names of all the metrics
*/
public SortedSet<String> getMetricNames() {
return Collections.unmodifiableSortedSet(new TreeSet<String>(metrics.keySet()));
}
代码示例来源:origin: prestodb/presto
/**
* 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);
}
代码示例来源:origin: prestodb/presto
@Override
<E> SortedSet<E> unmodifiableCollectionSubclass(Collection<E> collection) {
if (collection instanceof NavigableSet) {
return Sets.unmodifiableNavigableSet((NavigableSet<E>) collection);
} else {
return Collections.unmodifiableSortedSet((SortedSet<E>) collection);
}
}
代码示例来源:origin: prestodb/presto
@Override
<E> Collection<E> unmodifiableCollectionSubclass(Collection<E> collection) {
if (collection instanceof NavigableSet) {
return Sets.unmodifiableNavigableSet((NavigableSet<E>) collection);
} else if (collection instanceof SortedSet) {
return Collections.unmodifiableSortedSet((SortedSet<E>) collection);
} else {
return Collections.unmodifiableSet((Set<E>) collection);
}
}
代码示例来源:origin: prestodb/presto
UnmodifiableNavigableSet(NavigableSet<E> delegate) {
this.delegate = checkNotNull(delegate);
this.unmodifiableDelegate = Collections.unmodifiableSortedSet(delegate);
}
代码示例来源:origin: prestodb/presto
@Override
<E> Collection<E> unmodifiableCollectionSubclass(Collection<E> collection) {
if (collection instanceof NavigableSet) {
return Sets.unmodifiableNavigableSet((NavigableSet<E>) collection);
} else if (collection instanceof SortedSet) {
return Collections.unmodifiableSortedSet((SortedSet<E>) collection);
} else if (collection instanceof Set) {
return Collections.unmodifiableSet((Set<E>) collection);
} else if (collection instanceof List) {
return Collections.unmodifiableList((List<E>) collection);
} else {
return Collections.unmodifiableCollection(collection);
}
}
代码示例来源:origin: google/j2objc
@Override
<E> Collection<E> unmodifiableCollectionSubclass(Collection<E> collection) {
if (collection instanceof NavigableSet) {
return Sets.unmodifiableNavigableSet((NavigableSet<E>) collection);
} else if (collection instanceof SortedSet) {
return Collections.unmodifiableSortedSet((SortedSet<E>) collection);
} else {
return Collections.unmodifiableSet((Set<E>) collection);
}
}
代码示例来源:origin: google/j2objc
@Override
<E> SortedSet<E> unmodifiableCollectionSubclass(Collection<E> collection) {
if (collection instanceof NavigableSet) {
return Sets.unmodifiableNavigableSet((NavigableSet<E>) collection);
} else {
return Collections.unmodifiableSortedSet((SortedSet<E>) collection);
}
}
代码示例来源:origin: google/j2objc
@Override
<E> Collection<E> unmodifiableCollectionSubclass(Collection<E> collection) {
if (collection instanceof NavigableSet) {
return Sets.unmodifiableNavigableSet((NavigableSet<E>) collection);
} else if (collection instanceof SortedSet) {
return Collections.unmodifiableSortedSet((SortedSet<E>) collection);
} else if (collection instanceof Set) {
return Collections.unmodifiableSet((Set<E>) collection);
} else if (collection instanceof List) {
return Collections.unmodifiableList((List<E>) collection);
} else {
return Collections.unmodifiableCollection(collection);
}
}
代码示例来源:origin: google/guava
@Override
public SortedSet<V> get(K key) {
return Collections.unmodifiableSortedSet(delegate().get(key));
}
代码示例来源:origin: google/guava
@Override
public SortedSet<R> rowKeySet() {
return Collections.unmodifiableSortedSet(delegate().rowKeySet());
}
代码示例来源:origin: prestodb/presto
/**
* ZoneInfoProvider searches the given directory for compiled data files.
*
* @throws IOException if directory or map file cannot be read
*/
public ZoneInfoProvider(File fileDir) throws IOException {
if (fileDir == null) {
throw new IllegalArgumentException("No file directory provided");
}
if (!fileDir.exists()) {
throw new IOException("File directory doesn't exist: " + fileDir);
}
if (!fileDir.isDirectory()) {
throw new IOException("File doesn't refer to a directory: " + fileDir);
}
iFileDir = fileDir;
iResourcePath = null;
iLoader = null;
iZoneInfoMap = loadZoneInfoMap(openResource("ZoneInfoMap"));
iZoneInfoKeys = Collections.unmodifiableSortedSet(new TreeSet<String>(iZoneInfoMap.keySet()));
}
代码示例来源:origin: prestodb/presto
@Override
public SortedSet<R> rowKeySet() {
return Collections.unmodifiableSortedSet(delegate().rowKeySet());
}
代码示例来源:origin: prestodb/presto
@Override
public SortedSet<V> get(K key) {
return Collections.unmodifiableSortedSet(delegate().get(key));
}
内容来源于网络,如有侵权,请联系作者删除!