Guest User

Untitled

a guest
Jan 17th, 2019
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.59 KB | None | 0 0
  1. @FunctionalInterface
  2. public interface ToLongFunction<T> {
  3.  
  4. /**
  5. * Applies this function to the given argument.
  6. *
  7. * @param value the function argument
  8. * @return the function result
  9. */
  10. long applyAsLong(T value);
  11. }
  12.  
  13. package com.pay.screen;
  14.  
  15.  
  16. import java.util.ArrayList;
  17. import java.util.List;
  18.  
  19. public class MainTest {
  20.  
  21. public static void main(String[] args) {
  22. List<Long> list = new ArrayList<>();
  23. list.add(1L);
  24. list.add(2L);
  25. long sum = list.stream().mapToLong(Number::longValue).sum();
  26. System.out.println(sum);
  27.  
  28. }
  29. }
Add Comment
Please, Sign In to add comment