本文整理汇总了Java中com.google.common.collect.Maps.transformValues方法的典型用法代码示例。如果您正苦于以下问题:Java Maps.transformValues方法的具体用法?Java Maps.transformValues怎么用?Java Maps.transformValues使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.google.common.collect.Maps
的用法示例。
在下文中一共展示了Maps.transformValues方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: printStackTrace
import com.google.common.collect.Maps; //导入方法依赖的package包/类
private void printStackTrace(HttpServletRequest request, Throwable e) {
Map<String, String[]> params = request.getParameterMap();
Map<String, Object> map = Maps.transformValues(
params, arr -> (arr != null ? arr.length : 0) == 0 ? null : arr.length == 1 ? arr[0] : arr
);
log.error("handle:{}, params:{}", e.getClass().getName(), gson.toJson(map), e);
}
示例2: getAvgExecuteTime
import com.google.common.collect.Maps; //导入方法依赖的package包/类
public Map<String, Long> getAvgExecuteTime() {
return Maps.transformValues(map, new Function<MonitorRecord, Long>() {
@Override
public Long apply(MonitorRecord input) {
return input.getAvgExecuteTime();
}
});
}
示例3: getMaxExecuteTime
import com.google.common.collect.Maps; //导入方法依赖的package包/类
public Map<String, Long> getMaxExecuteTime() {
return Maps.transformValues(map, new Function<MonitorRecord, Long>() {
@Override
public Long apply(MonitorRecord input) {
return input.getMaxExecuteTime();
}
});
}
示例4: getTotalCount
import com.google.common.collect.Maps; //导入方法依赖的package包/类
public Map<String, Long> getTotalCount() {
return Maps.transformValues(map, new Function<MonitorRecord, Long>() {
@Override
public Long apply(MonitorRecord input) {
return input.getTotalCount();
}
});
}
示例5: getTotalTime
import com.google.common.collect.Maps; //导入方法依赖的package包/类
public Map<String, Long> getTotalTime() {
return Maps.transformValues(map, new Function<MonitorRecord, Long>() {
@Override
public Long apply(MonitorRecord input) {
return input.getTotalTime();
}
});
}
示例6: newAsyncConsistentMap
import com.google.common.collect.Maps; //导入方法依赖的package包/类
@Override
public <K, V> AsyncConsistentMap<K, V> newAsyncConsistentMap(String name, Serializer serializer) {
checkNotNull(name);
checkNotNull(serializer);
Map<PartitionId, AsyncConsistentMap<K, V>> maps =
Maps.transformValues(members,
partition -> partition.newAsyncConsistentMap(name, serializer));
Hasher<K> hasher = key -> {
int hashCode = Hashing.sha256().hashBytes(serializer.encode(key)).asInt();
return sortedMemberPartitionIds.get(Math.abs(hashCode) % members.size());
};
return new PartitionedAsyncConsistentMap<>(name, maps, hasher);
}
示例7: getMapLongList
import com.google.common.collect.Maps; //导入方法依赖的package包/类
public Map<Short, List<Long>> getMapLongList()
{
if (mapLongArray == null) {
return null;
}
return Maps.transformValues(this.mapLongArray, Longs::asList);
}
示例8: parametersAsMap
import com.google.common.collect.Maps; //导入方法依赖的package包/类
private Map<String, ImmutableMultiset<String>> parametersAsMap() {
return Maps.transformValues(
parameters.asMap(),
new Function<Collection<String>, ImmutableMultiset<String>>() {
@Override
public ImmutableMultiset<String> apply(Collection<String> input) {
return ImmutableMultiset.copyOf(input);
}
});
}
示例9: printErrorMsg
import com.google.common.collect.Maps; //导入方法依赖的package包/类
/**
* 打印异常信息和入参
*/
private void printErrorMsg(HttpServletRequest request, Throwable e) {
Map<String, String[]> params = request.getParameterMap();
Map<String, Object> map = Maps.transformValues(
params, arr -> arr.length == 0 ? null : arr.length == 1 ? arr[0] : arr
);
log.error("handle:{}, msg:{}, params:{}", e.getClass().getName(), e.getMessage(), JsonUtils.toJson(map));
}
示例10: printStackTrace
import com.google.common.collect.Maps; //导入方法依赖的package包/类
/**
* 打印堆栈和入参
*/
private void printStackTrace(HttpServletRequest request, Throwable e) {
Map<String, String[]> params = request.getParameterMap();
Map<String, Object> map = Maps.transformValues(
params, arr -> arr.length == 0 ? null : arr.length == 1 ? arr[0] : arr
);
log.error("handle:{}, params:{}", e.getClass().getName(), JsonUtils.toJson(map), e);
}
示例11: WildcardTypeCreator
import com.google.common.collect.Maps; //导入方法依赖的package包/类
public WildcardTypeCreator(Set<Type> unionTypeHelperTypes, Map<String, String> wildcardsByFqn) {
this.unionTypeHelperTypes = unionTypeHelperTypes;
this.wildcardsByFqn = new HashMap<>(Maps.transformValues(wildcardsByFqn, WildcardType::from));
}
示例12: delegate
import com.google.common.collect.Maps; //导入方法依赖的package包/类
private Map<K, V> delegate() {
return Maps.transformValues(
digestMap,
(valueDigest) -> expectValueType(valueDigest));
}
示例13: getAllByIds
import com.google.common.collect.Maps; //导入方法依赖的package包/类
public <I extends Id> Map<I, T> getAllByIds(Collection<I> ids) {
return Maps.transformValues(Maps.toMap(ids, this::getByIdAsync), Futures::getUnchecked);
}
示例14: tryFunctionsMap
import com.google.common.collect.Maps; //导入方法依赖的package包/类
public static Map<DataType, String> tryFunctionsMap() {
return Maps.transformValues(FUNCTION_MAP, TO_TRY_CAST_MAP);
}
示例15: toLeaderState
import com.google.common.collect.Maps; //导入方法依赖的package包/类
/**
* Transform frontend metadata into an active leader state map.
*
* @return Leader frontend state
*/
@Nonnull Map<FrontendIdentifier, LeaderFrontendState> toLeaderState(@Nonnull final Shard shard) {
return new HashMap<>(Maps.transformValues(clients, meta -> meta.toLeaderState(shard)));
}