@@ -19,7 +19,8 @@ public abstract class IPRange<T extends IPAddress & Comparable<T>> implements It
1919
2020 private static final long serialVersionUID = 1L ;
2121
22- protected static <T > T parseRange (String from , BiFunction <String , String , ? extends T > rangeProducer , Function <String , ? extends T > subnetProducer ) {
22+ protected static <T > T parseRange (String from , BiFunction <String , String , ? extends T > rangeProducer ,
23+ Function <String , ? extends T > subnetProducer ) {
2324 String [] parts = from .split ("-" );
2425 if (parts .length == 2 ) {
2526 return rangeProducer .apply (parts [0 ].trim (), parts [1 ].trim ());
@@ -29,18 +30,21 @@ protected static <T> T parseRange(String from, BiFunction<String, String, ? exte
2930 }
3031 return rangeProducer .apply (parts [0 ].trim (), parts [0 ].trim ());
3132 } else {
32- throw new IllegalArgumentException (String .format ("Inappropriate format for address range string %s." , from ));
33+ throw new IllegalArgumentException (
34+ String .format ("Inappropriate format for address range string %s." , from ));
3335 }
3436 }
3537
36- protected static <T > T parseSubnet (String from , BiFunction <String , Integer , ? extends T > subnetProducer , int singleAddressMask ) {
38+ protected static <T > T parseSubnet (String from , BiFunction <String , Integer , ? extends T > subnetProducer ,
39+ int singleAddressMask ) {
3740 final String [] parts = from .split ("/" );
3841 if (parts .length == 2 ) {
3942 return subnetProducer .apply (parts [0 ].trim (), Integer .parseInt (parts [1 ].trim ()));
4043 } else if (parts .length == 1 ) {
4144 return subnetProducer .apply (parts [0 ].trim (), singleAddressMask );
4245 } else {
43- throw new IllegalArgumentException (String .format ("Inappropriate format for address subnet string %s." , from ));
46+ throw new IllegalArgumentException (
47+ String .format ("Inappropriate format for address subnet string %s." , from ));
4448 }
4549 }
4650
@@ -53,7 +57,8 @@ protected static <T> T parseSubnet(String from, BiFunction<String, Integer, ? ex
5357 * range. To check whether all addresses are contained, use
5458 * {@link IPRange#contains(IPRange)}
5559 *
56- * @param range the range to check for overlap
60+ * @param range
61+ * the range to check for overlap
5762 * @return true if the given range overlaps with this one
5863 */
5964 public boolean overlaps (IPRange <T > range ) {
@@ -77,7 +82,8 @@ public boolean contains(T ip) {
7782 * Checks whether this range contains all addresses of a given range. To
7883 * check for partial overlap, use {@link IPRange#overlaps(IPRange)}
7984 *
80- * @param range range to check
85+ * @param range
86+ * range to check
8187 * @return true if the entire given range is contained within this range
8288 */
8389 public boolean contains (IPRange <T > range ) {
@@ -101,7 +107,7 @@ public boolean equals(Object obj) {
101107 if (this == obj ) {
102108 return true ;
103109 }
104- if (getClass () != obj . getClass ( )) {
110+ if (!( obj instanceof IPRange )) {
105111 return false ;
106112 }
107113 @ SuppressWarnings ("unchecked" )
@@ -130,7 +136,8 @@ public Iterator<T> iterator() {
130136 * Returns an iterator that optionally skips both the first and last
131137 * addresses in the range
132138 *
133- * @param trim set to true to skip first and last addresses
139+ * @param trim
140+ * set to true to skip first and last addresses
134141 * @return a new iterator instance
135142 */
136143 public Iterator <T > iterator (boolean trim ) {
@@ -141,8 +148,10 @@ public Iterator<T> iterator(boolean trim) {
141148 * Returns an iterator that optionally skips the first, last or both
142149 * addresses in the range
143150 *
144- * @param skipFirst set to true to skip the first address
145- * @param skipLast set to true to skip the last addresses
151+ * @param skipFirst
152+ * set to true to skip the first address
153+ * @param skipLast
154+ * set to true to skip the last addresses
146155 * @return a new iterator instance
147156 */
148157 public abstract Iterator <T > iterator (boolean skipFirst , boolean skipLast );
0 commit comments