Showing posts with label Functional Interface. Show all posts
Showing posts with label Functional Interface. Show all posts

Wednesday, July 10, 2019

Java 8 Functional Interfaces (FI)

1. Overview

In this tutorial, We'll learn about Functional Interface added to Java 8. Functional Interface is abbreviated as FI.

These Functional Interfaces are used extensively in Lambda Expressions.

Please read article on "A Complete Guide to Lambda Expressions"

If you have a basic understanding of Lambda's that will help in using Functional Interface(FI) properly. But, We will discuss in short about Lambda's.

Java 8 Functional Interfaces (FI)


We will cover the following concepts in this article.


  • Intro to Lambda
  • Lambda Examples
  • Functional Interface Definition
  • @FunctionalInterface annotation
  • Built-in FI's
  • Types of Functional Interfaces with examples


Tuesday, July 2, 2019

Java 8: Working with Supplier

1. Overview

In this tutorial, We'll learn about java 8 Supplier Functional Interface.

Supplier is part of package java.util.function. This is introduced in Java 8 as part of Function programming.

Api Reference

Supplier Functional Interface has only one Abstract method.


T get()

Where T -  the type of results supplied by this supplier

Java 8 - Working with Supplier


This method is called as Functional Method.

Supplier does not take any argument but returns a value always. Because of this named as Supplier as supplies everytime something when we call get() method.

Suppliers are very useful when we do not need to supply any value but need to return a value at the same time.