protected Map<K,V> copy() { TreeMap<K,V> m = new TreeMap<K,V>(comparator); m.putAll(core); return m; }
public void putAll(Map<? extends K, ? extends V> map) { this.treeMap.putAll(map); }
public void putAll(Map<? extends K, ? extends V> m) { base.putAll(m); }
public TreeSortedMap(Comparator<? super K> comparator, Map<? extends K, ? extends V> map) { this.treeMap = new TreeMap<K, V>(comparator); this.treeMap.putAll(map); }
public Map sort(final Class type, final Map nameMap) { TreeMap map = new TreeMap(comparator); map.putAll(nameMap); return map; }
/** * 排序Map * * @param <K> 键类型 * @param <V> 值类型 * @param map Map * @param comparator Entry比较器 * @return {@link TreeMap} * @since 3.0.9 */ public static <K, V> TreeMap<K, V> sort(Map<K, V> map, Comparator<? super K> comparator) { final TreeMap<K, V> result = new TreeMap<K, V>(comparator); result.putAll(map); return result; }
/** * 排序Map * * @param <K> 键类型 * @param <V> 值类型 * @param map Map * @param comparator Entry比较器 * @return {@link TreeMap} * @since 3.0.9 */ public static <K, V> TreeMap<K, V> sort(Map<K, V> map, Comparator<? super K> comparator) { final TreeMap<K, V> result = new TreeMap<K, V>(comparator); result.putAll(map); return result; }
public void rollback() { try { this.lockTreeMap.writeLock().lockInterruptibly(); try { this.msgTreeMap.putAll(this.consumingMsgOrderlyTreeMap); this.consumingMsgOrderlyTreeMap.clear(); } finally { this.lockTreeMap.writeLock().unlock(); } } catch (InterruptedException e) { log.error("rollback exception", e); } }
@JsonIgnore public TreeMap<String, NamespaceBundleStats> getSortedBundleStats(ResourceType resType) { if (bundleStats == null) { return null; } NamespaceBundleStatsComparator nsc = new NamespaceBundleStatsComparator(bundleStats, resType); TreeMap<String, NamespaceBundleStats> sortedBundleStats = Maps.newTreeMap(nsc); sortedBundleStats.putAll(bundleStats); return sortedBundleStats; }
sorted_map.putAll(map); System.out.println("results: " + sorted_map);
/** * Returns a map of all the flattened properties, the item in the returned map is sorted * alphabetically by the key value. * * @Return */ public Map<String, String> getFlattened() { final TreeMap<String, String> returnVal = new TreeMap<>(); returnVal.putAll(getMapByPrefix("")); return returnVal; }
public void printBrokerRuntimeStats(final DefaultMQAdminExt defaultMQAdminExt, final String brokerAddr, final boolean printBroker) throws InterruptedException, MQBrokerException, RemotingTimeoutException, RemotingSendRequestException, RemotingConnectException { KVTable kvTable = defaultMQAdminExt.fetchBrokerRuntimeStats(brokerAddr); TreeMap<String, String> tmp = new TreeMap<String, String>(); tmp.putAll(kvTable.getTable()); Iterator<Entry<String, String>> it = tmp.entrySet().iterator(); while (it.hasNext()) { Entry<String, String> next = it.next(); if (printBroker) { System.out.printf("%-24s %-32s: %s%n", brokerAddr, next.getKey(), next.getValue()); } else { System.out.printf("%-32s: %s%n", next.getKey(), next.getValue()); } } } }
@Override public DatabaseBranches clone() { DatabaseBranches clonedBranches = new DatabaseBranches(); clonedBranches.branches.putAll(branches); return clonedBranches; } }
/** * Clones the file history, including its file versions. Note that file versions * are not cloned, but copied by reference. * * @return Returns cloned file history */ @Override public PartialFileHistory clone() { PartialFileHistory clone = new PartialFileHistory(fileHistoryId); clone.versions.putAll(versions); return clone; }
/** * 新建TreeMap,Key有序的Map * * @param map Map * @param comparator Key比较器 * @return TreeMap * @since 3.2.3 */ public static <K, V> TreeMap<K, V> newTreeMap(Map<K, V> map, Comparator<? super K> comparator) { final TreeMap<K, V> treeMap = new TreeMap<>(comparator); if (false == isEmpty(map)) { treeMap.putAll(map); } return treeMap; }
/** * 新建TreeMap,Key有序的Map * * @param map Map * @param comparator Key比较器 * @return TreeMap * @since 3.2.3 */ public static <K, V> TreeMap<K, V> newTreeMap(Map<K, V> map, Comparator<? super K> comparator) { final TreeMap<K, V> treeMap = new TreeMap<>(comparator); if (false == isEmpty(map)) { treeMap.putAll(map); } return treeMap; }
@Override public TreeMap<Integer, T_SigPreKey> loadOmemoSignedPreKeys(OmemoDevice userDevice) { TreeMap<Integer, T_SigPreKey> sigPreKeys = getCache(userDevice).signedPreKeys; if (sigPreKeys.isEmpty() && persistent != null) { sigPreKeys.putAll(persistent.loadOmemoSignedPreKeys(userDevice)); } return new TreeMap<>(sigPreKeys); }
@Override public TreeMap<Integer, T_PreKey> loadOmemoPreKeys(OmemoDevice userDevice) { TreeMap<Integer, T_PreKey> preKeys = getCache(userDevice).preKeys; if (preKeys.isEmpty() && persistent != null) { preKeys.putAll(persistent.loadOmemoPreKeys(userDevice)); } return new TreeMap<>(preKeys); }
ReadableTransactionState build() { final ReadableTransactionState mock = Mockito.mock( ReadableTransactionState.class ); doReturn( new UnmodifiableMap<>( updates ) ).when( mock ).getIndexUpdates( any( SchemaDescriptor.class ) ); final TreeMap<ValueTuple, MutableLongDiffSetsImpl> sortedMap = new TreeMap<>( ValueTuple.COMPARATOR ); sortedMap.putAll( updates ); doReturn( sortedMap ).when( mock ).getSortedIndexUpdates( any( SchemaDescriptor.class ) ); return mock; } }
@SuppressWarnings("unchecked") private Map<String, Object> asMap(String json) throws java.io.IOException { final TreeMap<String, Object> result = new TreeMap<String, Object>(); result.putAll(JsonUtils.getMapper().readValue(json, Map.class)); return result; } }