Guest User

Untitled

a guest
Nov 28th, 2016
228
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.74 KB | None | 0 0
  1.  public static <T,R> List<R> manipulateList(List<T> recList,
  2.                                                Predicate<T> filterPredicate,
  3.                                                Comparator<T> comparatorT,
  4.                                                Function<T,R> mapTtoR,
  5.                                                Optional<Long> limit,
  6.                                                Optional<Long> offset) {
  7.  
  8.         return recList.stream()
  9.                       .filter(filterPredicate)
  10.                       .sorted(comparatorT)
  11.                       .skip(offset.orElse(0l))
  12.                       .limit(limit.orElse(Long.MAX_VALUE))
  13.                       .map(mapTtoR)
  14.                       .collect(Collectors.toList());
  15.  
  16.     }
Advertisement
Add Comment
Please, Sign In to add comment