Stream.Preview.LazySize

abstract class LazySize

When evaluated with comparison operators, [LazySize] preloads just enough stream elements to answer the questions

def s  : Stream[String]         = ???
def ps : Stream.Preview[String] = s.preview

ps.previewSize >= 10 // This will pre-load no more than 10 elements

ps.previewSize < 100 // This will pre-load no more than 100 elements
Source
LazySize.scala
class java.lang.Object
trait scala.Matchable
class Any

Def

@targetName("checkLess")
def <(i: Int): Boolean
@targetName("checkGreater")
def <=(i: Int): Boolean
@targetName("checkEqual")
def ==(i: Int): Boolean
@targetName("checkLeq")
def >(i: Int): Boolean
@targetName("checkGeq")
def >=(i: Int): Boolean
protected def preload(i: Int): Int
def size: Int

Total size

Total size

Preloads all elements, unless sizing is available in metadata

Source
LazySize.scala