jeudi 20 avril 2017

Java Method in Method in Java

I was searching several documents for getting answers but I couldn't.

What I want to code is "Methods in Method". Below is example in java8 (Stream API)

private static int sumStream(List<Integer> list) {
    return list.stream().filter(i -> i > 10).mapToInt(i -> i).sum();
}

In that codes, list call stream() method, stream() method called filter() method , mapToInt() method called sum() and return.

How can I code like this pattern?? Or, could you tell me search word in google or example codes please?

Aucun commentaire:

Enregistrer un commentaire