### Question:
MultilabelEvaluator { public <T> Result add(Set<T> trueLabels, Set<T> assignedLabels) { int intersectionSize = CollectionHelper.intersect(trueLabels, assignedLabels).size(); int trueSize = trueLabels.size(); int assignedSize = assignedLabels.size(); double precision = assignedSize != 0 ? (double) intersectionSize / assignedSize : 1; double recall = trueSize != 0 ? (double) intersectionSize / trueSize : 1; cumulatedPrecision += precision; cumulatedRecall += recall; count++; return new Result(precision, recall); }  Result add(Set<T> trueLabels, Set<T> assignedLabels); Result getResult(); int getCount();  }### Answer:
@Test public void testMultilabelEvaluator() { Set<Integer> actual = newHashSet(1, 2, 3); Set<Integer> assigned = newHashSet(1, 2, 4, 5); Result result = new MultilabelEvaluator().add(actual, assigned); assertEquals(0.5, result.getPrecision(), DELTA); assertEquals(0.6666666667, result.getRecall(), DELTA); assertEquals(0.5714285714, result.getF1(), DELTA); actual = emptySet(); assigned = emptySet(); result = new MultilabelEvaluator().add(actual, assigned); assertEquals(1, result.getF1(), DELTA); actual = newHashSet(1); assigned = emptySet(); result = new MultilabelEvaluator().add(actual, assigned); assertEquals(1, result.getPrecision(), DELTA); assertEquals(0, result.getRecall(), DELTA); assertEquals(0, result.getF1(), DELTA); actual = emptySet(); assigned = newHashSet(1); result = new MultilabelEvaluator().add(actual, assigned); assertEquals(0, result.getPrecision(), DELTA); assertEquals(1, result.getRecall(), DELTA); assertEquals(0, result.getF1(), DELTA); }