- Type Parameters:
A- address type
- All Superinterfaces:
AddressSet<A>,Iterable<A>
- All Known Subinterfaces:
Block<A>
AddressSet interface that forms contiguous range of one or more Addresses.
See AddressSet for implementation contract.
Implementations are always contiguous lists.
-
Method Summary
Modifier and TypeMethodDescriptiondefault booleanTests if the last value in either range is one less than the first value of the other.blocks()Streams arbitrary range as valid CIDR blocks.default booleandefault booleancontiguous(Range<A> r) Tests if this range can create a contiguous range with another.Combines two ranges into a single range using the least and greatest values from each.family()Convenience method.first()Least element in the range.default booleanintersects(Range<A> r) Tests if there is any overlap in the address ranges.default booleanisEmpty()Range is never empty.iterator()All addresses in the range.last()Greatest element in the range.ranges()ConstituentRanges.default BigIntegersize()Number ofAddres in range.default Spliterator<A> stream()All addresses in the range.Methods inherited from interface uk.ipfreely.sets.AddressSet
addresses, equals, hashCode
-
Method Details
-
first
A first()Least element in the range.- Returns:
- first
-
last
A last()Greatest element in the range.- Returns:
- last
-
family
Convenience method.- Returns:
- range family
-
ranges
Description copied from interface:AddressSetConstituent
Ranges.Adjacent or overlapping ranges MUST be combined into a single
Range. Elements MUST be produced from leastAddress to greatest.A
StreamofAddress values can be obtained withranges().flatMap(Range::stream). AStreamofBlocks can be obtained withranges().flatMap(Range::blocks).- Specified by:
rangesin interfaceAddressSet<A extends Addr<A>>- Returns:
- constituent ranges
-
size
Number ofAddres in range. -
isEmpty
default boolean isEmpty()Range is never empty.- Specified by:
isEmptyin interfaceAddressSet<A extends Addr<A>>- Returns:
- false
-
contains
- Specified by:
containsin interfaceAddressSet<A extends Addr<A>>- Parameters:
address- candidate (cannot be null)- Returns:
- true if this sequence contains the given IP address
-
iterator
All addresses in the range. -
spliterator
Default
Spliterator.characteristics():Spliterator.IMMUTABLE;Spliterator.DISTINCT;Spliterator.ORDERED;Spliterator.SORTED;Spliterator.NONNULL. If smaller thanLong.MAX_VALUEalsoSpliterator.SIZEDandSpliterator.SUBSIZED.Spliterator.trySplit()is implemented.- Specified by:
spliteratorin interfaceAddressSet<A extends Addr<A>>- Specified by:
spliteratorin interfaceIterable<A extends Addr<A>>- Returns:
- all addresses in set
-
stream
All addresses in the range.- Returns:
- from first to last
-
blocks
Streams arbitrary range as valid CIDR blocks.- Returns:
- stream
-
contiguous
Tests if this range can create a contiguous range with another. That is, eitherintersects(Range)oradjacent(Range)are true.- Parameters:
r- another range- Returns:
- true if contiguous
-
intersects
Tests if there is any overlap in the address ranges.- Parameters:
r- another range- Returns:
- true on intersection
-
adjacent
Tests if the last value in either range is one less than the first value of the other.- Parameters:
r- another range- Returns:
- true if adjacent
-
extremes
Combines two ranges into a single range using the least and greatest values from each. The ranges do NOT have to be contiguous - this is not a union method.- Parameters:
other- another range- Returns:
- new range
- See Also:
-