@Test public void testEquals() { equivalenceTester() .addEquivalentGroup(Inet4Network.fromCidr("8.0.0.0/8")) .addEquivalentGroup(Inet4Network.fromCidr("9.0.0.0/8")) .addEquivalentGroup(Inet4Network.fromCidr("8.0.0.0/9")) .addEquivalentGroup(Inet4Network.fromCidr("8.8.8.0/24")) .addEquivalentGroup(Inet4Network.fromCidr("8.8.8.8/32")) .check(); }
@Override @SuppressWarnings("RedundantIfStatement") public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } Inet4Network that = (Inet4Network) o; if (bits != that.bits) { return false; } if (start != that.start) { return false; } return true; }
Inet4Network { @Override @SuppressWarnings("RedundantIfStatement") public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } Inet4Network that = (Inet4Network) o; if (bits != that.bits) { return false; } if (start != that.start) { return false; } return true; } }
Inet4Network { @Override @SuppressWarnings("RedundantIfStatement") public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } Inet4Network that = (Inet4Network) o; if (bits != that.bits) { return false; } if (start != that.start) { return false; } return true; } private  Inet4Network(Inet4Address address, int bits); }
Inet4Network { @Override @SuppressWarnings("RedundantIfStatement") public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } Inet4Network that = (Inet4Network) o; if (bits != that.bits) { return false; } if (start != that.start) { return false; } return true; } private  Inet4Network(Inet4Address address, int bits); boolean containsAddress(Inet4Address address); @Override String toString(); @Override @SuppressWarnings("RedundantIfStatement") boolean equals(Object o); @Override int hashCode(); @SuppressWarnings("StringSplitter") static Inet4Network fromCidr(String cidr); }
Inet4Network { @Override @SuppressWarnings("RedundantIfStatement") public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } Inet4Network that = (Inet4Network) o; if (bits != that.bits) { return false; } if (start != that.start) { return false; } return true; } private  Inet4Network(Inet4Address address, int bits); boolean containsAddress(Inet4Address address); @Override String toString(); @Override @SuppressWarnings("RedundantIfStatement") boolean equals(Object o); @Override int hashCode(); @SuppressWarnings("StringSplitter") static Inet4Network fromCidr(String cidr);  }