--
You received this message because you are subscribed to the Google Groups "Gnu/Linux Ethiopia" group.
To unsubscribe from this group and stop receiving emails from it, send an email to linux-ethiopi...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
plus1 :: [Int] -> [Int] | |
plus1 [] = [] | |
plus1 (x:xs) = x + 1 : plus1 xs | |
-- plus1 [0,1,2,3] | |
-- > [1,2,3,4] |
--
--
Eyob
Great points. Wish you the best
Belay
There are many ways of coding Singleton but this example is easy to understand.
public class EyobsSingleton {
private static EyobsSingleton instance = null;
protected EyobsSingleton() {
// Exists only to defeat instantiation.
}
public static EyobsSingleton getInstance() {
if(instance == null) {
instance = new EyobsSingleton();
}
return instance;
}
}
The EyobsSingleton class maintains a static reference to the lone singleton instance and returns that reference from the static getInstance() method.Eyob
Singletons are confusing. Read this article http://howtodoinjava.com/2012/10/22/singleton-design-pattern-in-java/
And forget the second code. You have a handful in the article
Belay
Eyob
Come back to all design patterns later.
Belay
Hi Belay,