public void sameSort(TreeMapsms, List trades, String str, String keyType) { if (StrUtil.isEmpty(str)) return; Map srcs = convertListToMap(trades, keyType); Set sets = Sets.newHashSet(str.split(",")); for (Long key : srcs.keySet()) { Set sets2 = new HashSet<>(); if ("functionId".equals(keyType)) { sets2 = Sets.newHashSet(srcs.get(key).getFunctionIds().split(",")); } else if ("consumerBenefit".equals(keyType)) { sets2 = Sets.newHashSet(srcs.get(key).getConsumerBenefitIds().split(",")); } else if ("incis".equals(keyType)) { sets2 = Sets.newHashSet(srcs.get(key).getInciIds().split(",")); } Sets.SetView intersection = Sets.intersection(sets, sets2); int n = intersection.size(); if (n > 0) { List allList; if (sms.get(n) == null) { allList = new ArrayList<>(); sms.put(n, allList); } else { allList = sms.get(n); } allList.add(srcs.get(key)); } } }
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)