IP - The type of IP address in the range.public abstract class AbstractIPRange<IP extends IPAddress<IP>> extends Object implements IPRange<IP>
IPRange interface.| Constructor and Description |
|---|
AbstractIPRange() |
| Modifier and Type | Method and Description |
|---|---|
boolean |
equals(Object obj)
Compares the specified object with this IP range for equality.
|
int |
hashCode()
Returns the hash code value for this IP range.
|
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, waitadd, addAll, clear, contains, contains, containsAll, forEach, from, isEmpty, iterator, remove, removeAll, removeIf, retainAll, size, to, toArray, toArrayparallelStream, spliterator, streampublic boolean equals(Object obj)
true if and only if the specified object is also an IP range,
and both IP ranges have the same from and to addresses.
This implies that both IP ranges contain the same IP addresses.
More formally, two IP ranges range1 and range2 are equal if
range1.from().equals(range2.from()) && range1.to().equals(range2.to())
This implementation first checks if the given object is this IP range; if so it returns true.
If not, it checks if the given object is another IP range. If so, it returns from().equals(range.from()) && to().equals(range.to())
according to the contract of IPRange.equals(Object).
public int hashCode()
from().hashCode() * 31 + to().hashCode()
This ensures that range1.equals(range2) implies that range1.hashCode() == range2.hashCode() for any two IP ranges
range1 and range2, as required by the general contract of Object.hashCode().
This implementation returns from().hashCode() * 31 + to().hashCode() according to the contract of IPRange.hashCode().
Copyright © 2019–2023. All rights reserved.