In Vim, you can use function or math in search and replace. 7100,111,222,0 7100,333,444,1 7100,555,666,2 :%s/\(\d*\)$/\=2-submatch(1)/g 7100,111,222,2 7100,333,444,1 7100,555,666,0
Enum Singletons are new way to implement Singleton pattern in Java by using Enum with just one instance. Though Singleton pattern in Java exists from long time Enum Singletons are relatively new concept and in practice from Java 5 onwards after introduction of Enum as keyword and feature. This article is somewhat related to my earlier post on Singleton, 10 interview questions on Singleton pattern in Java where we have discussed common questions asked on interviews about Singleton pattern and 10 Java enum examples , where we have seen how versatile enum can be. This post is about why should we use Enum as Singleton in Java , What benefit it offers compared to conventional singleton methods etc. 1) Enum Singletons are easy to write This is by far biggest advantage, if you have been writing Singletons prior ot Java 5 than you know that even with double checked locking you can have more than one instances. though that issue is fixed with Java memory model i...
Comments
Post a Comment