Example usage for java.lang Integer sum

List of usage examples for java.lang Integer sum

Introduction

In this page you can find the example usage for java.lang Integer sum.

Prototype

public static int sum(int a, int b) 

Source Link

Document

Adds two integers together as per the + operator.

Usage

From source file:Main.java

public static void main(String[] argv) {

    // Uses a lambda expression
    BiFunction<Integer, Integer, Integer> func1 = (x, y) -> Integer.sum(x, y);
    System.out.println(func1.apply(2, 3));

    // Uses a method reference
    BiFunction<Integer, Integer, Integer> func2 = Integer::sum;
    System.out.println(func2.apply(2, 3));

}