Java 8 - Default Methods

 Before Java 8, it was virtually impossible to change an interface once published. Any change e.g. addition of a new method would have broken all clients.  Since backward compatibility is top priority for Java engineers, and it wasn't practical to break all clients, they came up with idea of default method.  

Java 8 enables us to add non-abstract method implementations to interfaces by utilizing the default keyword. This feature is also known as Extension Methods. Here is an example:

interface Car{
    int drive(int speed, int direction);
    default int wheels(){
        return 4;

Besides the abstract method drive() the interface Caralso defines the default method wheels(). Any concrete classes of Carinterface only have to implement the abstract method drive(). The default method wheels() method can be used directly.

  Car myCar = new Car(){
      public int drive(int speed, int direction){
          return x*y;

int totalWheels = myCar.wheels();//Invokes the default implementation in the interface.


Fast boot the Android emulator in less than 15s

The default emulator is annoyingly slow. Read on this post to boot your emulator in 15s

1) You HAVE to have an Intel CPU, anything else (AMD) will NOT work. Too bad AMD users ;)

2) OPEN adt-bundle-xxx/SDK Manager.exe
3) Checkbox extras/Intel x86 Emulator Accelerator (HAXM)


4) Also checkbox Android 4.4.2 (API 19)/Intel x86 Atom System Image

5) INSTALL ... wait...

6) Upon completion, browse here:
 \adt-bundle-xxx\sdk\extras\intel\Hardware_Accelerated_Execution_Manager\IntelHaxm.exe and install the driver

7) Reset your computer (not sure if this is necessary, but do it anyway)

8) Finally start Eclipse >> Window >> Android VD Manager

9) Copy my settings; you can edit them later. As long as you ensure your CPU is intel atom, you're good. You can FURTHER speed up emulator by checking Use Host GPU. ALSO further speed up by using a lower resolution, like 800x600.