From 014cdd761830558589aa26d69d221970c6aaea18 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=92=B1=E6=B6=9B?= <15850646081@163.com> Date: Fri, 17 Oct 2025 17:29:31 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E6=9C=89=E5=BA=8Fmap?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/com/engine/salary/util/SalaryEntityUtil.java | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/com/engine/salary/util/SalaryEntityUtil.java b/src/com/engine/salary/util/SalaryEntityUtil.java index 0b2a6d474..03cc7c8df 100644 --- a/src/com/engine/salary/util/SalaryEntityUtil.java +++ b/src/com/engine/salary/util/SalaryEntityUtil.java @@ -135,6 +135,15 @@ public class SalaryEntityUtil { .collect(Collectors.toMap(keyMapper, valueMapper, (a, b) -> a)); } + public static Map convert2LinkedMap(Collection objs, Function keyMapper, Function valueMapper) { + if (CollectionUtils.isEmpty(objs)) { + return Maps.newHashMap(); + } + return objs.stream() + .filter(e -> valueMapper.apply(e) != null && keyMapper.apply(e) != null) + .collect(Collectors.toMap(keyMapper, valueMapper, (a, b) -> a, LinkedHashMap::new)); + } + public static Map> group2Map(Collection objs, Function function) { if (CollectionUtils.isEmpty(objs)) { return Maps.newHashMap();