20. Java 8+
- Review the presentation Java 8+
Tasks
- Review the package jtm.activity20
- Create an entry RandomPerson
- Add new methods to the PersonMatcher interface:
- Method Stream<RandomPerson> getPersonStream()
default method Stream<RandomPerson> getMatchedPersonStream() with parameters:
- Stream<RandomPerson> persons,
- boolean isFemale,
- int ageFrom,
- int ageTo,
- float weightFrom,
- float weightTo
This method should return a Stream with the passed persons filtered according to the passed gender, age range, and weight range (including). Tip: You can use stream filter model.
- static method List<RandomPerson> getPersonList(Stream<RandomPerson> persons)
- static method PersonMatcher getPersonManager()
- Implement the default and static method in the PersonMatcher interface.
- Create a class PersonMatcherImpl that implements the PersonMatcher interface and implement its methods:
- public constructor PersonMatcherImpl()
- public void addPerson(RandomPerson person)
- public List<RandomPerson> getPersonList()
public Stream<RandomPerson> getPersonStream()
Tip: You can use Stream.Builder.
- Verify that the unit tests for the jtm.activity20 package pass.