@Test public void should_track_deltas_between_updates() { subject.updateValues(Arrays.asList(1, 2, 3)); assertThat(delta(0).get().getAdditions()).containsExactly(1, 2, 3); subject.updateValues(Arrays.asList(2, 3, 4)); assertThat(delta(1).get().getAdditions()).containsExactly(4); assertThat(delta(1).get().getRemovals()).containsExactly(1); subject.updateValues(Arrays.asList(3, 4, 5)); assertThat(delta(2).get().getAdditions()).containsExactly(5); assertThat(delta(2).get().getRemovals()).containsExactly(2); assertThat(delta(1).get().getAdditions()).containsExactly(4, 5); assertThat(delta(1).get().getRemovals()).containsExactly(1, 2); subject.updateValues(Arrays.asList(4, 5, 6)); assertThat(delta(3).get().getAdditions()).containsExactly(6); assertThat(delta(3).get().getRemovals()).containsExactly(3); assertThat(delta(2).get().getAdditions()).containsExactly(5, 6); assertThat(delta(2).get().getRemovals()).containsExactly(2, 3); assertThat(delta(1).get().getAdditions()).containsExactly(4, 5, 6); assertThat(delta(1).get().getRemovals()).containsExactly(1, 2, 3); subject.updateValues(Arrays.asList(1, 2, 3)); assertThat(delta(4).get().getAdditions()).containsExactly(1, 2, 3); assertThat(delta(4).get().getRemovals()).containsExactly(4, 5, 6); assertThat(delta(3).get().getAdditions()).containsExactly(1, 2); assertThat(delta(3).get().getRemovals()).containsExactly(4, 5); assertThat(delta(2).get().getAdditions()).containsExactly(1); assertThat(delta(2).get().getRemovals()).containsExactly(4); assertThat(delta(1).get().getAdditions()).containsExactly(); assertThat(delta(1).get().getRemovals()).containsExactly(); subject.updateValues(Arrays.asList()); assertThat(delta(5).get().getAdditions()).containsExactly(); assertThat(delta(5).get().getRemovals()).containsExactly(1, 2, 3); assertThat(delta(4).get().getAdditions()).containsExactly(); assertThat(delta(4).get().getRemovals()).containsExactly(4, 5, 6); assertThat(delta(3).get().getAdditions()).containsExactly(); assertThat(delta(3).get().getRemovals()).containsExactly(3, 4, 5); assertThat(delta(2).get().getAdditions()).containsExactly(); assertThat(delta(2).get().getRemovals()).containsExactly(2, 3, 4); assertThat(delta(1).get().getAdditions()).containsExactly(); assertThat(delta(1).get().getRemovals()).containsExactly(1, 2, 3); }
public boolean updateValues(Collection<T> newValues) { return updateValues(newValues.stream()); }
VersionedSet { public boolean updateValues(Collection<T> newValues) { return updateValues(newValues.stream()); } }
VersionedSet { public boolean updateValues(Collection<T> newValues) { return updateValues(newValues.stream()); } VersionedSet();  VersionedSet(SerialNumber initialVersion); }
VersionedSet { public boolean updateValues(Collection<T> newValues) { return updateValues(newValues.stream()); } VersionedSet();  VersionedSet(SerialNumber initialVersion); boolean updateValues(Collection<T> newValues); boolean updateValues(Stream<T> newValues); Set<SerialNumber> forgetDeltasBefore(SerialNumber version); Optional<Delta<T>> getDelta(SerialNumber version); int size(); }
VersionedSet { public boolean updateValues(Collection<T> newValues) { return updateValues(newValues.stream()); } VersionedSet();  VersionedSet(SerialNumber initialVersion); boolean updateValues(Collection<T> newValues); boolean updateValues(Stream<T> newValues); Set<SerialNumber> forgetDeltasBefore(SerialNumber version); Optional<Delta<T>> getDelta(SerialNumber version); int size();  }