Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions raft/src/main/java/org/apache/kafka/raft/VoterSet.java
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,13 @@
*/
public final class VoterSet {
private final Map<Integer, VoterNode> voters;
private final Set<ReplicaKey> voterKeys;

private VoterSet(Map<Integer, VoterNode> voters) {
this.voters = voters;
this.voterKeys = voters.values().stream()
.map(VoterNode::voterKey)
.collect(Collectors.toUnmodifiableSet());
}

/**
Expand Down Expand Up @@ -144,11 +148,7 @@ public Set<Integer> voterIds() {
* Returns all of the voters.
*/
public Set<ReplicaKey> voterKeys() {
return voters
.values()
.stream()
.map(VoterNode::voterKey)
.collect(Collectors.toSet());
return voterKeys;
}

/**
Expand Down