scala / 3.1 / scala / collection / mutable / growable.html

Trait scala.collection.mutable.Growable

trait Growable[-A] extends Clearable

This trait forms part of collections that can be augmented using a += operator and that can be cleared of all elements using a clear method.

Supertypes
Known subtypes
64 types

Abstract methods

Source
def addOne(elem: A): Growable[A]

Adds a single element to this growable collection.

Value parameters
elem

the element to add.

Returns

the growable collection itself

Concrete methods

Source@inline
final def ++=(xs: IterableOnce[A]): Growable[A]

Alias for addAll

Source@inline
final def +=(elem: A): Growable[A]

Alias for addOne

Source
def addAll(xs: IterableOnce[A]): Growable[A]

Adds all elements produced by an IterableOnce to this growable collection.

Value parameters
xs

the IterableOnce producing the elements to add.

Returns

the growable collection itself.

Source
def knownSize: Int

Returns

The number of elements in the collection under construction, if it can be cheaply computed, -1 otherwise. The default implementation always returns -1.

Inherited methods

Source
def clear(): Unit

Clears the collection's contents. After this operation, the collection is empty.

Inherited from Clearable

© 2002-2022 EPFL, with contributions from Lightbend.
Licensed under the Apache License, Version 2.0.
https://scala-lang.org/api/3.1.1/scala/collection/mutable/Growable.html