guava的Map使用

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/qq_32405433/article/details/79214027

把主键作为key

Map<Long, EmallFeeDto> feeItemMap = Maps.newHashMap();

List<EmallFeeDto> feeDtoList = Lists.newArrayList();
if (feeDtoList != null) {
feeItemMap = Maps. uniqueIndex( feeDtoList, new Function<EmallFeeDto, Long>() {
@Override
public Long apply(EmallFeeDto input) {
return input.getFeeId();
}
});
}

猜你喜欢

转载自blog.csdn.net/qq_32405433/article/details/79214027