Functional Interface
Marked with @FunctionalInterface. Should contain 1 abstract method only. You can however have other static or default methods. Also make sure it is an interface, not an abstract class.
Extending a functional interface
If you extend a functional interface and don’t declare any new methods, then it will also be a functional interface.
Lambda rules
Polymorphism
You can pass an instance of a class to anything which expects an instance of its super class or interface it implements (Note: all objects are accessed by reference, so you never have direct access to the object in memory)
Casting rules in polymorphism
Encapsulation
Is-a relationship
Known as the inheritance test. Class A extends B, so A is-a B. But be careful of any super classes as well in case the inheritance doesn’t make sense.
Has-a relationship
Object composition test. Used when an object has another object, which is included as a member of the object class.
Singleton Pattern
Singleton lazy initialisation
Immutable Objects
Builder
Should be in the same package or as a static inner class. If it’s in the same file as an inner class, then the constructor can be final, forcing you to use the Builder.