java stream
多字段map
Map<Integer, String> map = list.stream().collect(Collectors.toMap(Entity::getId, Entity::getType)); //可改成 Map<Integer, String> map = list.stream().collect(HashMap::new, (k, v) -> k.put(v.getId(), v.getType()),HashMap::putAll);
多字段map
Map<Integer, String> map = list.stream().collect(Collectors.toMap(Entity::getId, Entity::getType)); //可改成 Map<Integer, String> map = list.stream().collect(HashMap::new, (k, v) -> k.put(v.getId(), v.getType()),HashMap::putAll);