@Test public void testEquals() { new EqualsTester() .addEqualityGroup(partition1, sameAsPartition1) .addEqualityGroup(partition2, copyOfPartition2) .addEqualityGroup(partition3) .testEquals(); }
@Override public boolean equals(Object other) { if (!(other instanceof DefaultPartition)) { return false; } DefaultPartition that = (DefaultPartition) other; return this.getId().equals(that.getId()) && Sets.symmetricDifference(Sets.newHashSet(this.members), Sets.newHashSet(that.members)).isEmpty(); }
DefaultPartition implements Partition { @Override public boolean equals(Object other) { if (!(other instanceof DefaultPartition)) { return false; } DefaultPartition that = (DefaultPartition) other; return this.getId().equals(that.getId()) && Sets.symmetricDifference(Sets.newHashSet(this.members), Sets.newHashSet(that.members)).isEmpty(); } }
DefaultPartition implements Partition { @Override public boolean equals(Object other) { if (!(other instanceof DefaultPartition)) { return false; } DefaultPartition that = (DefaultPartition) other; return this.getId().equals(that.getId()) && Sets.symmetricDifference(Sets.newHashSet(this.members), Sets.newHashSet(that.members)).isEmpty(); } protected  DefaultPartition();  DefaultPartition(PartitionId id, Collection<NodeId> members);  DefaultPartition(Partition other); }
DefaultPartition implements Partition { @Override public boolean equals(Object other) { if (!(other instanceof DefaultPartition)) { return false; } DefaultPartition that = (DefaultPartition) other; return this.getId().equals(that.getId()) && Sets.symmetricDifference(Sets.newHashSet(this.members), Sets.newHashSet(that.members)).isEmpty(); } protected  DefaultPartition();  DefaultPartition(PartitionId id, Collection<NodeId> members);  DefaultPartition(Partition other); @Override PartitionId getId(); @Override Collection<NodeId> getMembers(); @Override String toString(); @Override int hashCode(); @Override boolean equals(Object other); }
DefaultPartition implements Partition { @Override public boolean equals(Object other) { if (!(other instanceof DefaultPartition)) { return false; } DefaultPartition that = (DefaultPartition) other; return this.getId().equals(that.getId()) && Sets.symmetricDifference(Sets.newHashSet(this.members), Sets.newHashSet(that.members)).isEmpty(); } protected  DefaultPartition();  DefaultPartition(PartitionId id, Collection<NodeId> members);  DefaultPartition(Partition other); @Override PartitionId getId(); @Override Collection<NodeId> getMembers(); @Override String toString(); @Override int hashCode(); @Override boolean equals(Object other);  }