google / mug

A small Java 8 library (string manipulation, stream utils)
Apache License 2.0
367 stars 65 forks source link

Undo optimization that breaks compound BiStream operations #9

Closed andrewparmet closed 6 years ago

andrewparmet commented 6 years ago

Undoes the optimization in e5d4516 which broke compound map + sort operations on BiStreams (https://github.com/google/mug/issues/8).

Without f094b07 four tests fail:

Failed tests:   testMappedKeysAndSortedByValues(com.google.mu.util.stream.BiStreamCompoundTest): Not true that <{c=[2, 2, 2]}> contains exactly <{b=[1], c=[2], a=[3]}>. It is missing <{b=[1], a=[3]}> and has unexpected items <{c=[2 [2 copies]]}>
  testMappedKeysAndSortedByKeys(com.google.mu.util.stream.BiStreamCompoundTest): Not true that <{b=[3, 3, 3]}> contains exactly <{a=[1], b=[3], c=[2]}>. It is missing <{a=[1], c=[2]}> and has unexpected items <{b=[3 [2 copies]]}>
  testMappedValuesAndSortedByValues(com.google.mu.util.stream.BiStreamCompoundTest): Not true that <{c=[2, 2, 2]}> contains exactly <{b=[1], c=[2], a=[3]}>. It is missing <{b=[1], a=[3]}> and has unexpected items <{c=[2 [2 copies]]}>
  testMappedValuesAndSortedByKeys(com.google.mu.util.stream.BiStreamCompoundTest): Not true that <{b=[3, 3, 3]}> contains exactly <{a=[1], b=[3], c=[2]}>. It is missing <{a=[1], c=[2]}> and has unexpected items <{b=[3 [2 copies]]}>

Please let me know if this is not the direction you'd like to go or if there should be any changes. Thanks!

fluentfuture commented 6 years ago

Thanks for reporting the bug!

I'll take a look later to see if it's possible to revive the optimization.