From ad254f84b3f26187de5704dd3ccee2876a227a70 Mon Sep 17 00:00:00 2001 From: Ole Hansen Date: Wed, 11 Jun 2014 15:31:01 +0200 Subject: [PATCH] Added singleton pattern --- snippets/java.snippets | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/snippets/java.snippets b/snippets/java.snippets index c3986d3..e0965f1 100644 --- a/snippets/java.snippets +++ b/snippets/java.snippets @@ -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}