Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @FunctionalInterface
- public interface ToLongFunction<T> {
- /**
- * Applies this function to the given argument.
- *
- * @param value the function argument
- * @return the function result
- */
- long applyAsLong(T value);
- }
- package com.pay.screen;
- import java.util.ArrayList;
- import java.util.List;
- public class MainTest {
- public static void main(String[] args) {
- List<Long> list = new ArrayList<>();
- list.add(1L);
- list.add(2L);
- long sum = list.stream().mapToLong(Number::longValue).sum();
- System.out.println(sum);
- }
- }
Add Comment
Please, Sign In to add comment