Scala shorthand for ending a stream? -


With the practice of currents, I am searching for a normal pattern to end a stream like this:
  

stream.cons (lastValue, stream.empty)

It seems that this would be a similar pattern that is probably a short story

  stream. Finish (lastValue) // is not a real skial code   

Is such a function made in Scala?

natural options, stream (final value) does not work in general because Not applicable is not lazy, but you can use it when you do not care that you've already specified the value.

You can probably use Stream.fill (1) ()

  lastValue #: stream.empty   < P> personal.   

Comments

Popular posts from this blog

sql - Return Function using Cursor -

sql server - How to use pivot in this table -

javascript - Is there any way to add a new parameter to a function programmatically? -