Newer
Older
stream-utils / README.md
@aljunggren aljunggren on 4 Jan 2022 467 bytes Initial commit

Stream Utils

A collection of useful steam utilities

Slice

Get a subset of a Stream

StreamUtils.getSlice(steam, 0, 5);

Get a subset of a List

StreamUtils.getSlice(list, 0, 5);

Distinct by Key

Predicate used to filter objects by a given property

List<User> uniqueUsersByLastname = users.stream()
        .filter(StreamUtils.distinctByKey(user -> user.getLastName()))
        .collect(Collectors.toList());