Interface AddressComponentSpliterator<T extends AddressComponentRange>
- Type Parameters:
T-
- All Superinterfaces:
AddressComponentRangeSpliterator<T,T>, Spliterator<T>
- Author:
- seancfoley
-
Nested Class Summary
Nested classes/interfaces inherited from interface Spliterator
Spliterator.OfDouble, Spliterator.OfInt, Spliterator.OfLong, Spliterator.OfPrimitive<T,T_CONS, T_SPLITR> -
Field Summary
Fields inherited from interface Spliterator
CONCURRENT, DISTINCT, IMMUTABLE, NONNULL, ORDERED, SIZED, SORTED, SUBSIZED -
Method Summary
Modifier and TypeMethodDescriptiontrySplit()If this spliterator can be partitioned, returns a Spliterator covering elements, that will, upon return from this method, not be covered by this Spliterator.Methods inherited from interface AddressComponentRangeSpliterator
getAddressItem, getComparator, getSizeMethods inherited from interface Spliterator
characteristics, estimateSize, forEachRemaining, getExactSizeIfKnown, hasCharacteristics, tryAdvance
-
Method Details
-
trySplit
AddressComponentSpliterator<T> trySplit()Description copied from interface:AddressComponentRangeSpliteratorIf this spliterator can be partitioned, returns a Spliterator covering elements, that will, upon return from this method, not be covered by this Spliterator.The returned Spliterator will cover a strict prefix of the elements, preserving the ordering of the address items.
Repeated calls to
trySplit()will eventually returnnull. Upon non-null return, the sizes of the new spliterator and this spliterator as given byAddressComponentRangeSpliterator.getSize()will add up to the size of this spliterator before splitting.The remaining elements of segment spliterators will be divided exactly in half.
Other address item spliterators divide the original address item roughly in half, not the remaining elements. Because the original address item is divided instead of dividing the remaining elements, the resulting spliterators will not be roughly equal in size if a disproportionate amount of traversing using
Spliterator.tryAdvance(java.util.function.Consumer)occurred before splitting. In fact, the splitting will not happen at all if half the elements have already been traversed.- Specified by:
trySplitin interfaceAddressComponentRangeSpliterator<T extends AddressComponentRange, T extends AddressComponentRange>- Specified by:
trySplitin interfaceSpliterator<T extends AddressComponentRange>- Returns:
- a
Spliteratorcovering some portion of the elements, ornullif this spliterator cannot be split
-