Class ImmutableRangeMap.Builder<K extends java.lang.Comparable<?>,​V>

  • Enclosing class:
    ImmutableRangeMap<K extends java.lang.Comparable<?>,​V>

    public static final class ImmutableRangeMap.Builder<K extends java.lang.Comparable<?>,​V>
    extends java.lang.Object
    A builder for immutable range maps. Overlapping ranges are prohibited.
    • Constructor Detail

      • Builder

        public Builder()
    • Method Detail

      • put

        public ImmutableRangeMap.Builder<K,​V> put​(Range<K> range,
                                                        V value)
        Associates the specified range with the specified value.
        Throws:
        java.lang.IllegalArgumentException - if range overlaps with any other ranges inserted into this builder, or if range is empty
      • putAll

        public ImmutableRangeMap.Builder<K,​V> putAll​(RangeMap<K,​? extends V> rangeMap)
        Copies all associations from the specified range map into this builder.
        Throws:
        java.lang.IllegalArgumentException - if any of the ranges in rangeMap overlap with ranges already in this builder
      • build

        public ImmutableRangeMap<K,​V> build()
        Returns an ImmutableRangeMap containing the associations previously added to this builder.