guava:
Preconditions.checkArgument(AppUtil.notNullOrDefault(departmentId), "无效的部门id: %s", departmentId);
Preconditions.checkArgument(uid != null && uid.isValid(), "无效的用户: %s", uid);
lamba:
1 Map<Long,Object>
Map<Long,Object> map = new HashMap<>();
map.stream().map(map::get).filter(Objects::nonNull).collect(Collectors.toList());
2 List->Map
Map<Long, DepartmentReferenceRelation> departmentIdToReference = departmentReferenceRelations.stream().collect(Collectors.toMap(DepartmentReferenceRelation::getDepartmentId, d -> d));
3 filter && sort
transactions.parallelStream().filter(t -> t.getType() == Transaction.GROCERY).sorted(comparing(Transaction::getValue).reversed()).map(Transaction::getId).collect(toList());
4 string -> List<String> -> List<Integer>
List<String> strList = Splitter.on(",").trimResults().omitEmptyStrings().splitToList(str);
strList.stream().map(strItem -> Integer.parseInt(strItem)).collect(Collectors.toList());
5 List<T>->Set<Integer>
Set<Integer> userAclIdSet = userAclList.stream().map(sysAcl -> sysAcl.getId()).collect(Collectors.toSet());
6 stream of
String categories=Stream.of(productRankDTO.getCategoryPath().split(">")).collect(Collectors.joining(">"));
List<Long> idList = Stream.of(ids.split(",")).map(x -> Long.valueOf(x)).collect(Collectors.toList());