Skip to content
Permalink
Browse files

Step 7: Filtering by Issue Type

  • Loading branch information...
tlinkowski committed Jan 31, 2019
1 parent 274dedb commit 549549855dd14a69e5716767800232aa34433cc1
Showing with 9 additions and 0 deletions.
  1. +3 −0 IssueWiseText.java
  2. +6 −0 Usage.java
@@ -1,7 +1,10 @@
import java.util.List;
import java.util.function.Predicate;

interface IssueWiseText<I extends Issue> {
String text(); // e.g. "You migth know it."

List<I> issues(); // e.g. ["migth"]

IssueWiseText<I> filtered(Predicate<? super I> issueFilter);
}
@@ -5,6 +5,12 @@ static double issueCoverage(Stream<? extends IssueWiseText<?>> textStream) {
return textStream.collect(IssueCoverage.collector());
}

static double issueCoverage(Stream<? extends IssueWiseText<?>> textStream, IssueType issueType) {
return textStream
.map(text -> text.filtered(issue -> issue.type() == issueType))
.collect(IssueCoverage.collector());
}

static Stream<IssueWiseText<Issue>> testCaseStream() {
return Stream.of();
}

0 comments on commit 5495498

Please sign in to comment.
You can’t perform that action at this time.