Hot Posts

hot/hot-posts

Java 8 - Basic Overview





1. Lambda Expressions (Anonymous functions (Parameters -> Expressions).
2. Functional Interfaces.
3. Default Methods.
4. Streams.
5. Date API.

Rules of Lambda Functions
1. It has 0 or more parameters.
2. Type of the parameters can be explicitly declared.
3. There can be Parenthesis for multiple parameters.
4. Body can have 0 or More statements.
5. Types are inferred by java compiler.


Functional Interfaces (SAM – Single Abstract Method)
1. Can add any number of default methods
2. Can override Object Class methods

Default Methods
1. Used to ensure backward compatibility.
2. Can be overridden in implemented Class.

Streams
1. It can process a set of data like filtering, transformation
2. Supports multiple kinds of iterations.

Date Time API
1. Java 8 Supports multiple classes like LocalDate, LocalTime and LocalDateTime.
2. For timezones, OffsetDate, OffsetTime and OffsetDateTime
3. Instant Class is used for timestamps.
4. Duration and Period Class are used to calculate time difference.

Post a Comment

0 Comments