本文整理汇总了Java中java.util.Collections.unmodifiableSortedMap方法的典型用法代码示例。如果您正苦于以下问题:Java Collections.unmodifiableSortedMap方法的具体用法?Java Collections.unmodifiableSortedMap怎么用?Java Collections.unmodifiableSortedMap使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类java.util.Collections
的用法示例。
在下文中一共展示了Collections.unmodifiableSortedMap方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: unmodifiableMap
import java.util.Collections; //导入方法依赖的package包/类
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);
}
}
示例2: unmodifiableMap
import java.util.Collections; //导入方法依赖的package包/类
private static <K, V> Map<K, V> unmodifiableMap(Map<K, V> map) {
if (map instanceof SortedMap) {
return Collections.unmodifiableSortedMap((SortedMap<K, ? extends V>) map);
} else {
return Collections.unmodifiableMap(map);
}
}
示例3: getObject
import java.util.Collections; //导入方法依赖的package包/类
protected SortedMap<String, String> getObject() {
SortedMap<String, String> map = new TreeMap<String, String>();
map.put("key", "value");
return Collections.unmodifiableSortedMap(map);
}
示例4: getAnotherObject
import java.util.Collections; //导入方法依赖的package包/类
protected SortedMap<String, String> getAnotherObject() {
SortedMap<String, String> map = new TreeMap<String, String>();
return Collections.unmodifiableSortedMap(map);
}
示例5: delegate
import java.util.Collections; //导入方法依赖的package包/类
@Override
protected SortedMap<K, V> delegate() {
return Collections.unmodifiableSortedMap(delegate);
}
示例6: tailMap
import java.util.Collections; //导入方法依赖的package包/类
public SortedMap<K, V> tailMap(final K fromKey) {
return Collections.unmodifiableSortedMap(delegate.tailMap(fromKey));
}
示例7: getFlagMap
import java.util.Collections; //导入方法依赖的package包/类
public SortedMap<EncodingNode, Flag> getFlagMap() {
return Collections.unmodifiableSortedMap(flags);
}
示例8: subMap
import java.util.Collections; //导入方法依赖的package包/类
public SortedMap<K, V> subMap(final K fromKey, final K toKey) {
return Collections.unmodifiableSortedMap(delegate.subMap(fromKey, toKey));
}
示例9: headMap
import java.util.Collections; //导入方法依赖的package包/类
@Override
public SortedMap<K, V> headMap(K toKey) {
return Collections.unmodifiableSortedMap(delegate.headMap(toKey));
}
示例10: makeUnmodifiable
import java.util.Collections; //导入方法依赖的package包/类
@SuppressWarnings({"unchecked", "rawtypes", "SuspiciousSystemArraycopy"})
@Nullable
public static <T> T makeUnmodifiable(Object collection)
{
if (collection.getClass().isArray())
{
int length = Array.getLength(collection);
if (length == 0)
{
return (T) DioriteArrayUtils.getEmptyObjectArray(collection.getClass().getComponentType());
}
Object copy = DioriteArrayUtils.newArray(collection.getClass().getComponentType(), length);
System.arraycopy(collection, 0, copy, 0, length);
return (T) copy;
}
Function function = unmodifiableWrappers.get(collection.getClass());
if (function == null)
{
for (Entry<Class<?>, Function<?, ?>> entry : unmodifiableWrappers.entrySet())
{
if (entry.getKey().isInstance(collection))
{
function = entry.getValue();
break;
}
}
if (function != null)
{
unmodifiableWrappers.put(collection.getClass(), function);
return (T) function.apply(collection);
}
if (collection instanceof Collection)
{
if (collection instanceof Set)
{
if (collection instanceof NavigableSet)
{
return (T) Collections.unmodifiableNavigableSet((NavigableSet<?>) collection);
}
if (collection instanceof SortedSet)
{
return (T) Collections.unmodifiableSortedSet((SortedSet<?>) collection);
}
return (T) Collections.unmodifiableSet((Set<?>) collection);
}
if (collection instanceof List)
{
return (T) Collections.unmodifiableList((List<?>) collection);
}
return (T) Collections.unmodifiableCollection((Collection<?>) collection);
}
else if (collection instanceof Map)
{
if (collection instanceof NavigableMap)
{
return (T) Collections.unmodifiableNavigableMap((NavigableMap<?, ?>) collection);
}
if (collection instanceof SortedMap)
{
return (T) Collections.unmodifiableSortedMap((SortedMap<?, ?>) collection);
}
return (T) Collections.unmodifiableMap((Map<?, ?>) collection);
}
else
{
new RuntimeException("Can't make this collection unmodifiable: " + collection.getClass().getName()).printStackTrace();
return (T) collection;
}
}
return (T) function.apply(collection);
}
示例11: tailMap
import java.util.Collections; //导入方法依赖的package包/类
@Override
public SortedMap<K, V> tailMap(K fromKey) {
return Collections.unmodifiableSortedMap(delegate.tailMap(fromKey));
}
示例12: headMap
import java.util.Collections; //导入方法依赖的package包/类
public SortedMap<K, V> headMap(final K toKey) {
return Collections.unmodifiableSortedMap(delegate.headMap(toKey));
}
示例13: unmodifiableSortedMap
import java.util.Collections; //导入方法依赖的package包/类
/**
* 返回包装后不可修改的有序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);
}
示例14: getComponentMap
import java.util.Collections; //导入方法依赖的package包/类
/**
* Returns the (possibly empty) mapping from component type graphs
* to the elements defined therein.
* The map is only nonempty if this is a composite type graph, filled
* through calls of {@link #add(TypeGraph)}.
*/
public SortedMap<String,Sub> getComponentMap() {
return Collections.unmodifiableSortedMap(this.componentMap);
}