scala - safe Iterator.max -


Is there a library that provides functions like Iterator.max , but it Option [A] possibly due to a A account for blank eaterators? Alternatively, is there any library that provides class PosInf [A] or A to do this?

What to do for me, but using a library is always better to duplicate the code.)

: MA.maximum Usage:

  import scalaz._; Import Scalaz._ List (1, 2, 3) .maximum == Some (3) List.empty [Int] .maximum == Any   

The only problem is that it is not You can work directly with Iterators, so you instead (like Iterator.toStream )

  list (using 1, 2)  stream < / Code>, 3) .iterator.toStream.maximum = some (3)    

Comments

Popular posts from this blog

mysql - BLOB/TEXT column 'value' used in key specification without a key length -

c# - Using Vici cool Storage with monodroid -

python - referencing a variable in another function? -