org.apache.cassandra.db.commitlog

## Class IntervalSet<T extends java.lang.Comparable<T>>

- java.lang.Object
- - org.apache.cassandra.db.commitlog.IntervalSet<T>

    public class IntervalSet<T extends java.lang.Comparable<T>>
    extends java.lang.Object

An immutable set of closed intervals, stored in normalized form (i.e. where overlapping intervals are converted to a single interval covering both). The set is stored as a sorted map from interval starts to the corresponding end. The map satisfies `curr().getKey() <= curr().getValue() < next().getKey()`

### Nested Class Summary

Nested Classes
`static class` `IntervalSet.Builder<T extends java.lang.Comparable<T>>` Builder of interval sets, applying the necessary normalization while adding ranges.

### Constructor Summary

Constructors
Constructor and Description
`IntervalSet(T start, T end)` Construct new set containing the interval with the given start and end position.

### Method Summary

All Methods Static Methods Instance Methods Concrete Methods
`boolean` `contains(T position)`
`static <T extends java.lang.Comparable<T>> IntervalSet<T>` `empty()`
`java.util.Collection<T>` `ends()`
`boolean` `equals(java.lang.Object obj)`
`int` `hashCode()`
`boolean` `isEmpty()`
`java.util.Optional<T>` `lowerBound()`
`static <T extends java.lang.Comparable<T>> ISerializer<IntervalSet<T>>` `serializer(ISerializer<T> pointSerializer)`
`java.util.Collection<T>` `starts()`
`java.lang.String` `toString()`
`java.util.Optional<T>` `upperBound()`

### Methods inherited from class java.lang.Object

`clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

### Constructor Detail

#### IntervalSet

    public IntervalSet(T start,
                       T end)

Construct new set containing the interval with the given start and end position.

### Method Detail

#### empty

    public static <T extends java.lang.Comparable<T>> IntervalSet<T> empty()

#### contains

    public boolean contains(T position)

#### isEmpty

    public boolean isEmpty()

#### lowerBound

    public java.util.Optional<T> lowerBound()

#### upperBound

    public java.util.Optional<T> upperBound()

#### starts

    public java.util.Collection<T> starts()

#### ends

    public java.util.Collection<T> ends()

#### toString

    public java.lang.String toString()

Overrides:
  `toString` in class `java.lang.Object`

#### hashCode

    public int hashCode()

Overrides:
  `hashCode` in class `java.lang.Object`

#### equals

    public boolean equals(java.lang.Object obj)

Overrides:
  `equals` in class `java.lang.Object`

#### serializer

    public static final <T extends java.lang.Comparable<T>> ISerializer<IntervalSet<T>> serializer(ISerializer<T> pointSerializer)