Java In A Nutshell— Function Interfaces, Lambdas and Method References

Introduction

let n = (param1) => someOperation(param1);
n();

Creating a Function Interface

Utilising a Lambda

So lambdas are just method declaration and implementation references?

// :: denotes we're referencing a method
FunctionInterfaceStaticType name = Class::methodName;

Built in Functional Interfaces

Predicates

Functions

Suppliers

Consumers

Comparators

Additional Function Interfaces

Bi Functional Interfaces

Function<Param Type, Return Type>
BiFunction<Param t1, Param t2, return t>

Working with Primitives

  1. DoubleFunction
  2. LongFunction
  3. IntFunction

Final

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Alexanderkilroy

I'm just a self taught developer from England, honestly, that's it lol.