stream的groupby出来的map是有顺序的map

stream分组后的map是有序map

List<RedisInstanceTypeDto> typeDtoList = ModuleHelper.mapAll(redisInstanceTypes,RedisInstanceTypeDto.class);
        Map<Integer,List<RedisInstanceTypeDto>> memoryGBMap = typeDtoList.stream().collect(Collectors.groupingBy(RedisInstanceTypeDto::getMemoryGB, LinkedHashMap::new,Collectors.toList()));
posted @ 2021-05-12 20:32  SpecialSpeculator  阅读(1638)  评论(0编辑  收藏  举报