Android supported Java8 features


  • default and static methods in Interfaces
    • default and static methods can be declared in Interfaces declarations. These methods don't need to be implemented by the Classes that are implementing those interfaces. static methods are attached to the Interface and Classes which implements such interfaces.
    • Reference: https://docs.oracle.com/javase/tutorial/java/IandI/defaultmethods.html
  • Repeating Annotations
    • Now one annotation can be used multiple times on a specific target.
    • Reference: https://docs.oracle.com/javase/tutorial/java/annotations/repeating.html
  • Lambda expressions:
    • Lambda expressions enable to treat functionality as method argument or code as data.
    • Lambda exp is useful especially to define anonymous class with one method
    • Reference: https://docs.oracle.com/javase/tutorial/java/javaOO/lambdaexpressions.html
    • Syntax for Lambda expressions: https://docs.oracle.com/javase/tutorial/java/javaOO/lambdaexpressions.html#syntax

Terms:
  • Functional interfaces: An interface with only method is called as functional interfaces. JDK defines few built-in functional interfaces in package: java.util.function 

No comments:

Post a Comment

Scheduling Repeating Local Notifications using Alarm Manager

Learn about Scheduling Repeating Local Notifications using Alarm Manager in this post .