public static <T> TimestampPartitioningMap<T> of(RangeMap<Long, T> initialState) { return ImmutableTimestampPartitioningMap.of( initialState.asMapOfRanges() .entrySet() .stream() .map(entry -> RangeAndValue.of(entry.getKey(), entry.getValue())) .collect(Collectors.toSet())); }
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()); }
public static <T> TimestampPartitioningMap<T> of(RangeMap<Long, T> initialState) { return ImmutableTimestampPartitioningMap.of( initialState.asMapOfRanges() .entrySet() .stream() .map(entry -> RangeAndValue.of(entry.getKey(), entry.getValue())) .collect(Collectors.toSet())); }
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()); }