Skip to content

Commit

Permalink
Added singleton pattern
Browse files Browse the repository at this point in the history
  • Loading branch information
cinocode committed Jun 11, 2014
1 parent c24c99c commit ad254f8
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions snippets/java.snippets
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand Down

0 comments on commit ad254f8

Please sign in to comment.