+ 23

Does Java have sth like "generatores" of Python?

maybe we can create its behaviour with static variables?

15th May 2018, 8:24 AM
Amir
Amir - avatar
8 Answers
+ 5
Stream generators? :)
24th May 2018, 11:22 PM
Jakub DubaƄski
Jakub DubaƄski - avatar
+ 3
Generators? Yes Java has a pseudo generator method that uses the RANDOM math class. Its already a unary operator.
22nd May 2018, 1:29 AM
Apple Blossom
Apple Blossom - avatar
+ 2
you may create streams but they are different. rxJava may be an alternative.
18th May 2018, 12:40 AM
Manuel Soto
Manuel Soto - avatar
+ 1
Unary in that it doesn't need two operands to work.
22nd May 2018, 2:52 AM
Apple Blossom
Apple Blossom - avatar
+ 1
better than random stream is to create a stream from data or from iterator (Stream.iterate) which is a bit similar but can't create infinite stream and consume memory. generators don't consume memory
22nd May 2018, 3:03 AM
Manuel Soto
Manuel Soto - avatar
0
Janet Jane can you post a reference ?
22nd May 2018, 1:54 AM
Manuel Soto
Manuel Soto - avatar
22nd May 2018, 2:57 AM
Apple Blossom
Apple Blossom - avatar