Custom Postfix Templates

Compatible with: IntelliJ IDEA Android Studio
Mar 17, 2018
2 727
Documentation | Screencast | Predefined templates

This plugin allows you to define your own postfix templates for Java, Scala, Kotlin, and JavaScript. It comes with a set of predefined templates which can be edited and extended, e.g.:
  • string.toInt → Integer.parse(string)
  • array.toList → Arrays.asList(array)
  • file.lines → Files.readAllLines(file.toPath(), Charset.forName("UTF-8"))
  • file.getName().val → final String name = file.getName();

Download plugin

Recent change notes

Version 1.6.2
  • Fixed that the dollar character ($) could not be used in template code.

General usage instructions

Go to Tools → Custom Postfix Templates and write your own postfix templates for your code or just the predefined ones to simplify your life. For instance, write "array.toList" and see how it gets replaced by "Arrays.asList(array)". Other predefined but editable templates are: toByte, toChar, toInt, toLong, toFloat, toDouble ● toList, toSet, toMap ● sort, sortBy, minBy, maxBy, groupBy ● exists, forall ● reverse, concat ● Optional.forEach ● String.r