IDEA lambda生成模板,让编码速度像火箭起飞
editor > live templates > 右上角新增模板依次添加如下模板abbreviation: lambdaMapKeyOneIntegertemplate text:Map<Integer, $Object$> integer$Object$Map = $list$.stream().collect(Collectors.toMap($Object$::ge
editor > live templates > 右上角新增模板
依次添加如下模板
abbreviation: lambdaMapKeyOneInteger
template text:
Map<Integer, $Object$> integer$Object$Map = $list$.stream().collect(Collectors.toMap($Object$::get$field$,Function.identity()));
abbreviation: lambdaMapKeyOneLong
template text:
Map<Long, $Object$> long$Object$Map = $list$.stream().collect(Collectors.toMap($Object$::get$field$,Function.identity()));
abbreviation: lambdaMapKeyOneString
template text:
Map<String, $Object$> str$Object$Map = $list$.stream().collect(Collectors.toMap($Object$::get$field$,Function.identity()));
abbreviation: lambdaMapKeyListInteger
template text:
Map<Integer, List<$Object$>> integer$Object$ListMap = $list$.stream().collect(Collectors.groupingBy($Object$::get$field$));
abbreviation: lambdaMapKeyListLong
template text:
Map<Long, List<$Object$>> long$Object$ListMap = $list$.stream().collect(Collectors.groupingBy($Object$::get$field$));
abbreviation: lambdaMapKeyListString
template text:
Map<String, List<$Object$>> string$Object$ListMap = $list$.stream().collect(Collectors.groupingBy($Object$::get$field$));
abbreviation: lambdaIdsSplit
template text:
List<Integer> ids = Arrays.stream($ids$.split(",")).map(s -> Integer.valueOf(s.trim())).collect(Collectors.toList());
abbreviation: lambdaIdsLong
template text:
List<Long> ids = $list$.stream().map($Object$::get$field$).collect(Collectors.toList());
abbreviation: lambdaIdsInteger
template text:
List<Integer> ids = $list$.stream().map($Object$::get$field$).collect(Collectors.toList());
abbreviation: lambdaIdsString
template text:
List<String> ids = $list$.stream().map($Object$::get$field$).collect(Collectors.toList());
abbreviation: lambdaFilter
template text:
List<$Object$> $list$ = $list$.stream().filter(rs -> "a".equals(rs.get$field$)).collect(Collectors.toList());
当你在idea中输入lambda,然后按Ctrl+j ,神奇的效果出现了,开启lambda表达式编写速度double,有木有!
代码提示
回车
提示后,输入动态参数,done!

GitCode 天启AI是一款由 GitCode 团队打造的智能助手,基于先进的LLM(大语言模型)与多智能体 Agent 技术构建,致力于为用户提供高效、智能、多模态的创作与开发支持。它不仅支持自然语言对话,还具备处理文件、生成 PPT、撰写分析报告、开发 Web 应用等多项能力,真正做到“一句话,让 Al帮你完成复杂任务”。
更多推荐
所有评论(0)