knownSize
to be O(1)
, it also must be very fast
knownSize
is always O(1)
in the library so far. I would say O(log n)
is more like O(1)
than like O(n)
(in the sense that O(log n)^2
is less than O(n)
), so if it happened somehow to take O(log n)
time to compute knownSize
it probably should be computed instead of returning -1
.
IterableOnce
or an Iterator
without looping myself? Wouldn't last
/lastOption
make sense for them (I know the other right-oriented variants takeRight
/dropRight
were removed earlier from the strawman as they would require buffering, but last
/lastOption
would only need a buffer of size one)?
ListBuffer.from(iterableOnce).lastOption
reduce
and fold
also work
List
for instance, Seq
wants concat
to mean appendedAll
, but there's a StrictOptimizedIterableOps#concat
that gets mixed in later..
concat
enate" implies an order, but the paint's dry on that shed, I'm sure)
SortedSetLike
? I see no mention of it in https://github.com/scala/collection-strawman/wiki/FAQ#how-do-i-cross-build-my-project-against-scala-212-and-scala-213
get
updateInPlaceWith(key: K, f: V => V): this.type
?
f: Option[V] => V
or ifPresent: V => V, ifAbsent: => V
compute
) by using null
if it's absent, but that seems like not a great idea in Scala (arguably not a great idea in Java either)