TimestampPartitioningMap { public TimestampPartitioningMap<T> copyInstallingNewValue( long lowerBoundForNewVersion, T newValue) { RangeAndValue<T> latestEntry = getLatestEntry(); validateProvidedTimestampBounds(lowerBoundForNewVersion, newValue, latestEntry); ImmutableRangeMap.Builder<Long, T> builder = ImmutableRangeMap.builder(); copyOldRangesFromPreviousMap(latestEntry, builder); addNewRanges(lowerBoundForNewVersion, newValue, latestEntry, builder); return ImmutableTimestampPartitioningMap.of(builder.build()); }  @Value.Lazy RangeMap<Long, T> rangeMapView(); static TimestampPartitioningMap<T> of(RangeMap<Long, T> initialState); T getValueForTimestamp(long timestamp); TimestampPartitioningMap<T> copyInstallingNewValue(
            long lowerBoundForNewVersion,
            T newValue); @Value.Check void check();  }
@Test public void throwsWhenInstallingVersionInThePast() { TimestampPartitioningMap<Integer> newMap = DEFAULT_INITIAL_MAPPING.copyInstallingNewValue(TIMESTAMP_2, 2); assertThatThrownBy(() -> newMap.copyInstallingNewValue(TIMESTAMP_1, 2)) .isInstanceOf(IllegalArgumentException.class) .hasMessageContaining("Cannot install a new value at an earlier timestamp"); }