本文整理了Java中java.util.Collections.unmodifiableSortedMap()
方法的一些代码示例,展示了Collections.unmodifiableSortedMap()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Collections.unmodifiableSortedMap()
方法的具体详情如下:
包路径:java.util.Collections
类名称:Collections
方法名:unmodifiableSortedMap
[英]Returns a wrapper on the specified sorted map which throws an UnsupportedOperationException whenever an attempt is made to modify the sorted map.
[中]返回指定排序映射上的包装器,每当尝试修改排序映射时,该包装器将抛出UnsupportdOperationException。
代码示例来源:origin: google/guava
@Override
protected SortedMap<K, V> delegate() {
return Collections.unmodifiableSortedMap(delegate);
}
代码示例来源:origin: google/guava
private static <K, V> Map<K, V> unmodifiableMap(Map<K, ? extends V> map) {
if (map instanceof SortedMap) {
return Collections.unmodifiableSortedMap((SortedMap<K, ? extends V>) map);
} else {
return Collections.unmodifiableMap(map);
}
}
代码示例来源:origin: google/guava
@Override
protected SortedMap<String, String> create(Entry<String, String>[] entries) {
SortedMap<String, String> map = populate(new TreeMap<String, String>(), entries);
return Collections.unmodifiableSortedMap(map);
}
})
代码示例来源:origin: prestodb/presto
@Override
protected SortedMap<K, V> delegate() {
return Collections.unmodifiableSortedMap(delegate);
}
代码示例来源:origin: springside/springside4
/**
* 返回包装后不可修改的有序Map.
*
* @see java.util.Collections#unmodifiableSortedMap(SortedMap)
*/
public static <K, V> SortedMap<K, V> unmodifiableSortedMap(final SortedMap<K, ? extends V> m) {
return Collections.unmodifiableSortedMap(m);
}
代码示例来源:origin: google/j2objc
private static <K, V> Map<K, V> unmodifiableMap(Map<K, ? extends V> map) {
if (map instanceof SortedMap) {
return Collections.unmodifiableSortedMap((SortedMap<K, ? extends V>) map);
} else {
return Collections.unmodifiableMap(map);
}
}
代码示例来源:origin: vipshop/vjtools
/**
* 返回包装后不可修改的有序Map.
*
* @see java.util.Collections#unmodifiableSortedMap(SortedMap)
*/
public static <K, V> SortedMap<K, V> unmodifiableSortedMap(final SortedMap<K, ? extends V> m) {
return Collections.unmodifiableSortedMap(m);
}
代码示例来源:origin: SonarSource/sonarqube
public SortedMap<Integer, Integer> hitsByLine() {
return Collections.unmodifiableSortedMap(hitsByLine);
}
代码示例来源:origin: SonarSource/sonarqube
public SortedMap<Integer, Integer> conditionsByLine() {
return Collections.unmodifiableSortedMap(conditionsByLine);
}
代码示例来源:origin: SonarSource/sonarqube
public SortedMap<Integer, Integer> coveredConditionsByLine() {
return Collections.unmodifiableSortedMap(coveredConditionsByLine);
}
代码示例来源:origin: prestodb/presto
private static <K, V> Map<K, V> unmodifiableMap(Map<K, ? extends V> map) {
if (map instanceof SortedMap) {
return Collections.unmodifiableSortedMap((SortedMap<K, ? extends V>) map);
} else {
return Collections.unmodifiableMap(map);
}
}
代码示例来源:origin: wildfly/wildfly
private static <K, V> Map<K, V> unmodifiableMap(Map<K, ? extends V> map) {
if (map instanceof SortedMap) {
return Collections.unmodifiableSortedMap((SortedMap<K, ? extends V>) map);
} else {
return Collections.unmodifiableMap(map);
}
}
代码示例来源:origin: jenkinsci/jenkins
/**
* Gets all the builds in a map.
*/
public SortedMap<Integer, RunT> getBuildsAsMap() {
return Collections.<Integer, RunT>unmodifiableSortedMap(_getRuns());
}
代码示例来源:origin: jenkinsci/jenkins
/**
* Returns a read-only view of records that has already been loaded.
*/
public SortedMap<Integer,R> getLoadedBuilds() {
return Collections.unmodifiableSortedMap(new BuildReferenceMapAdapter<R>(this, index.byNumber));
}
代码示例来源:origin: google/guava
@Override
public SortedMap<R, Map<C, V>> rowMap() {
Function<Map<C, V>, Map<C, V>> wrapper = unmodifiableWrapper();
return Collections.unmodifiableSortedMap(Maps.transformValues(delegate().rowMap(), wrapper));
}
代码示例来源:origin: commons-io/commons-io
/**
* Constructs a sorted map from canonical charset names to charset objects required of every implementation of the
* Java platform.
* <p>
* From the Java documentation <a href="https://docs.oracle.com/javase/7/docs/api/java/nio/charset/Charset.html">
* Standard charsets</a>:
* </p>
*
* @return An immutable, case-insensitive map from canonical charset names to charset objects.
* @see Charset#availableCharsets()
* @since 2.5
*/
public static SortedMap<String, Charset> requiredCharsets() {
// maybe cache?
final TreeMap<String, Charset> m = new TreeMap<>(String.CASE_INSENSITIVE_ORDER);
m.put(StandardCharsets.ISO_8859_1.name(), StandardCharsets.ISO_8859_1);
m.put(StandardCharsets.US_ASCII.name(), StandardCharsets.US_ASCII);
m.put(StandardCharsets.UTF_16.name(), StandardCharsets.UTF_16);
m.put(StandardCharsets.UTF_16BE.name(), StandardCharsets.UTF_16BE);
m.put(StandardCharsets.UTF_16LE.name(), StandardCharsets.UTF_16LE);
m.put(StandardCharsets.UTF_8.name(), StandardCharsets.UTF_8);
return Collections.unmodifiableSortedMap(m);
}
代码示例来源:origin: wildfly/wildfly
@Override
public SortedMap<R, Map<C, V>> rowMap() {
Function<Map<C, V>, Map<C, V>> wrapper = unmodifiableWrapper();
return Collections.unmodifiableSortedMap(Maps.transformValues(delegate().rowMap(), wrapper));
}
代码示例来源:origin: prestodb/presto
@Override
public SortedMap<R, Map<C, V>> rowMap() {
Function<Map<C, V>, Map<C, V>> wrapper = unmodifiableWrapper();
return Collections.unmodifiableSortedMap(Maps.transformValues(delegate().rowMap(), wrapper));
}
代码示例来源:origin: prestodb/presto
private static SortedMap<Integer, Object> indexObjectValues(Type type, Block block)
{
SortedMap<Integer, Object> values = new TreeMap<>();
for (int position = 0; position < block.getPositionCount(); position++) {
values.put(position, type.getObjectValue(SESSION, block, position));
}
return unmodifiableSortedMap(values);
}
}
代码示例来源:origin: jenkinsci/jenkins
/**
* @param fromKey
* Biggest build number to be in the returned set.
* @param toKey
* Smallest build number-1 to be in the returned set (-1 because this is exclusive)
*/
public SortedMap<Integer, R> subMap(Integer fromKey, Integer toKey) {
// TODO: if this method can produce a lazy map, that'd be wonderful
// because due to the lack of floor/ceil/higher/lower kind of methods
// to look up keys in SortedMap, various places of Jenkins rely on
// subMap+firstKey/lastKey combo.
R start = search(fromKey, DESC);
if (start==null) return EMPTY_SORTED_MAP;
R end = search(toKey, ASC);
if (end==null) return EMPTY_SORTED_MAP;
for (R i=start; i!=end; ) {
i = search(getNumberOf(i)-1,DESC);
assert i!=null;
}
return Collections.unmodifiableSortedMap(new BuildReferenceMapAdapter<R>(this, index.byNumber.subMap(fromKey, toKey)));
}
内容来源于网络,如有侵权,请联系作者删除!