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()));
原文地址:https://www.cnblogs.com/PythonOrg/p/14761588.html