Created
March 19, 2015 13:25
-
-
Save thomaseizinger/6f8419cc13974cbebc67 to your computer and use it in GitHub Desktop.
A live template for IntelliJ IDEA to insert and encapsulate a list in Java. Paste the snippet into live template group under ~/.IntelliJIdeaXX/config/templates/
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<template name="inslist" value="private java.util.List<$T$> $ts$ = new $listType$<$T$>(); public java.util.List<$T$> get$Ts$() { return java.util.Collections.unmodifiableList($ts$); } private void set$Ts$(List<$T$> $ts$) { this.$ts$ = $ts$; } public void add$T$($T$ $t$) { this.$ts$.add($t$); } public void remove$T$($T$ $t$) { this.$ts$.remove($t$); }" description="Insert and encapsulate a list" toReformat="false" toShortenFQNames="true"> | |
<variable name="T" expression="" defaultValue="" alwaysStopAt="true" /> | |
<variable name="listType" expression="subtypes()" defaultValue="" alwaysStopAt="true" /> | |
<variable name="Ts" expression="capitalize(ts)" defaultValue="" alwaysStopAt="false" /> | |
<variable name="t" expression="suggestVariableName()" defaultValue="" alwaysStopAt="false" /> | |
<variable name="ts" expression="suggestVariableName()" defaultValue="" alwaysStopAt="false" /> | |
<context> | |
<option name="JAVA_DECLARATION" value="true" /> | |
</context> | |
</template> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment