This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public class PetRepository implements Container { | |
| private class NameIterator implements Iterator { | |
| int index = 0; | |
| @Override | |
| public boolean hasNext() { | |
| return index < pets.length; | |
| } | |
| @Override |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public interface Iterator { | |
| boolean hasNext(); | |
| Object next(); | |
| } | |
| public interface Container { | |
| Iterator getIterator(); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public interface Strategy { | |
| public int doOperation(int num1, int num2); | |
| } | |
| public class OperationAdd implements Strategy{ | |
| @Override | |
| public int doOperation(int num1, int num2) { | |
| return num1 + num2; | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public enum Elvis { | |
| INSTANCE; | |
| public void someMethod() {...} | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public class Elvis { | |
| private static final Elvis INSTANCE = new Elvis(); | |
| public static Elvis getInstance() { | |
| return INSTANCE; | |
| } | |
| private Elvis() {...} | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public class Something { | |
| private static class LazyHolder { | |
| private static final Something INSTANCE = new Something(); | |
| } | |
| public static Something getInstance() { | |
| return LazyHolder.INSTANCE; | |
| } | |
| private Something() {} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class Foo { | |
| private Helper helper = null; | |
| public Helper getHelper() { | |
| if (helper == null) { | |
| synchronized(this) { | |
| if (helper == null) { | |
| helper = new Helper(); | |
| } | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public class Singleton { | |
| private volatile static Singleton uniqueInstance; | |
| public static Singleton getInstance() { | |
| if (uniqueInstance == null) { | |
| synchronized (Singleton.class) { | |
| if (uniqueInstance == null) { | |
| uniqueInstance = new Singleton(); | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| sudo snap install snapcraft || brew install snapcraft | |
| snapcraft login | |
| snapcraft register lepton | |
| snapcraft push --release stable Lepton_1.6.2_amd64.snap |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.