Intellij IDEA自定义Live Templates提高编码效率

Intellij IDEA Live Templates

详情见: https://www.cnblogs.com/expiator/p/17380434.html

自定义Live Templates的示例

以下的示例,都是使用首字母,作为关键词。不一定要全打出来,有提示了按enter选取就行。

LIVE TEMPLATE --- list

  • 初始化String类型的list:

Abbreviation:

lsna

Template text:

List<String> $END$List = new ArrayList<>();
  • 初始化Integer类型的list:

Abbreviation:

lina

Template text:

List<Integer> $END$List = new ArrayList<>();

LIVE TEMPLATE --- Map

  • 初始化String, String的 Map:

Abbreviation:

mssnh

Template text:

Map<String, String> $END$Map = new HashMap<>();
  • 初始化String, Integer 的 Map:

Abbreviation:

msinh

Template text:

Map<String, Integer> $END$Map = new HashMap<>();
  • 初始化Integer, Integer 的 Map:

Abbreviation:

miinh

Template text:

Map<Integer, Integer> $END$Map = new HashMap<>();

LIVE TEMPLATE --- Set

  • 初始化String的 Set:
    Abbreviation:
ssnh

Template text:

Set<String> $END$Set = new HashSet<>();
  • 初始化String的 Set:
    Abbreviation:
sinh

Template text:

Set<Integer> $END$Set = new HashSet<>();

posted on 2023-05-07 23:27  乐之者v  阅读(31)  评论(0)    收藏  举报

导航