Extra 11: Java 8+
Main steps
- Ensure you are using Eclipse 4.x.
- Review package jtm.extra11 and class RandomPerson in package jtm.activity03.
- Add new methods into 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 Stream of passed persons filtered out according to passed gender, range of age and range of weight (including). Hint: you may use stream filter pattern.
- static method List<RandomPerson> getPersonList(Stream<RandomPerson> persons)
- static method PersonMatcher getPersonManager()
- Implement default and static methods in PersonMatcher interface.
- Create class PersonMatcherImpl which implements PersonMatcher interface and implement unimplemented methods for it:
- public constructor PersonMatcherImpl()
- public void addPerson(RandomPerson person)
- public List<RandomPerson> getPersonList()
public Stream<RandomPerson> getPersonStream()
Hint: you may use Stream.Builder.
- Check that unit test is passing for jtm.extra11 package.
- Check that unit tests are not failing for other packages (can fail if deprecated API of Java 7 was used in some implementation).