Added singleton pattern

This commit is contained in:
Ole Hansen 2014-06-11 15:31:01 +02:00
parent c24c99cc65
commit ad254f84b3

View File

@ -102,6 +102,18 @@ snippet d.hs
snippet d.st
Stack<${1:Object}> ${2:stack} = new Stack<$1>();${0}
##
## Singleton Pattern
snippet singlet
private static class Holder {
private static final ${1:`vim_snippets#Filename("$1")`} INSTANCE = new $1();
}
private $1() { }
private static $1 getInstance() {
return Holder.INSTANCE;
}
##
## Enhancements to Methods, variables, classes, etc.
snippet ab
abstract ${0}