dcapwell commented on code in PR #57:
URL: https://github.com/apache/cassandra-accord/pull/57#discussion_r1301880445


##########
accord-core/src/test/java/accord/utils/Gen.java:
##########
@@ -69,6 +89,16 @@ default Gen<A> filter(Predicate<A> fn)
         };
     }
 
+    default Supplier<A> asSupplier(RandomSource rs)
+    {
+        return () -> next(rs);
+    }
+
+    default Stream<A> asStream(RandomSource rs)
+    {
+        return Stream.generate(() -> next(rs));
+    }
+
     interface IntGen extends Gen<Integer>

Review Comment:
   > Why does this extend Gen<Integer>?
   
   Its so you can still use it in all contexts, by having disjoint interfaces 
that have the same shape, it gets harder to compose together.
   
   >  If this utility is to be more broadly used, it would be nice to simplify 
the reading and writing of test cases with it
   
   Can you expand on this?  Several tests use this and the `LongGen` version.
   
   > If we want to box or unbox, a boxed() method is preferable.
   
   I am +0 to `.boxed()` vs extends; they solve the same problem.  I can test 
this out but think I would need to add more methods to this type and gets 
easier for these primitive types to miss methods added to the base.



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to