Skip to content

Commit

Permalink
Remove redundant size counter (#973)
Browse files Browse the repository at this point in the history
  • Loading branch information
ghostcity committed Nov 22, 2020
1 parent 8ecd43c commit 88975a4
Showing 1 changed file with 1 addition and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@ public class StatusCounter {
*/
private Status finalStatus = Status.PASSED;

private int size = 0;

public StatusCounter(Resultsable[] resultsables) {
this(resultsables, Collections.emptySet());
}
Expand Down Expand Up @@ -53,7 +51,6 @@ public StatusCounter() {
public void incrementFor(Status status) {
final int statusCounter = getValueFor(status) + 1;
this.counter.put(status, statusCounter);
size++;

if (finalStatus == Status.PASSED && status != Status.PASSED) {
finalStatus = Status.FAILED;
Expand All @@ -76,7 +73,7 @@ public int getValueFor(Status status) {
* @return sum of all occurrences for all statuses
*/
public int size() {
return size;
return counter.values().stream().mapToInt(Integer::valueOf).sum();
}

/**
Expand Down

0 comments on commit 88975a4

Please sign in to comment.