@Override protected SortedMap<K, V> delegate() { return Collections.unmodifiableSortedMap(delegate); }
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); } }
@Override protected SortedMap<String, String> create(Entry<String, String>[] entries) { SortedMap<String, String> map = populate(new TreeMap<String, String>(), entries); return Collections.unmodifiableSortedMap(map); } })
@Override protected SortedMap<K, V> delegate() { return Collections.unmodifiableSortedMap(delegate); }
/** * 返回包装后不可修改的有序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); }
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); } }
/** * 返回包装后不可修改的有序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); }
public SortedMap<Integer, Integer> hitsByLine() { return Collections.unmodifiableSortedMap(hitsByLine); }
public SortedMap<Integer, Integer> conditionsByLine() { return Collections.unmodifiableSortedMap(conditionsByLine); }
public SortedMap<Integer, Integer> coveredConditionsByLine() { return Collections.unmodifiableSortedMap(coveredConditionsByLine); }
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); } }
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); } }
/** * Gets all the builds in a map. */ public SortedMap<Integer, RunT> getBuildsAsMap() { return Collections.<Integer, RunT>unmodifiableSortedMap(_getRuns()); }
/** * 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)); }
@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)); }
/** * 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); }
@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)); }
@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)); }
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); } }
/** * @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))); }