dcapwell commented on code in PR #3995: URL: https://github.com/apache/cassandra/pull/3995#discussion_r2004469337
########## test/unit/org/apache/cassandra/utils/Generators.java: ########## @@ -492,13 +494,20 @@ public static <T> Gen<Set<T>> set(Gen<T> gen, Gen<Integer> sizeGen) }; } - public static <T extends Comparable<? super T>> Gen<List<T>> uniqueList(Gen<T> gen, Gen<Integer> sizeGen) + public static <T> Gen<List<T>> uniqueList(Gen<T> gen, Gen<Integer> sizeGen) { - return set(gen, sizeGen).map(t -> { - List<T> list = new ArrayList<>(t); - list.sort(Comparator.naturalOrder()); - return list; - }); + return rnd -> { + int size = sizeGen.generate(rnd); + Set<T> set = Sets.newHashSetWithExpectedSize(size); + List<T> output = new ArrayList<>(size); + for (int i = 0; i < size; i++) + { + T value; + while (!set.add(value = gen.generate(rnd))) {} Review Comment: this isn't as safe as `uniqueBestEffort` from accord... once accord merges we can talk about unifying all this stuff... -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: pr-unsubscr...@cassandra.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: pr-unsubscr...@cassandra.apache.org For additional commands, e-mail: pr-h...@cassandra.apache.org