On this page
Class GrowableBuilder.GrowableBuilder
The canonical builder for collections that are growable, i.e. that support an efficient +=
method which adds an element to the collection.
GrowableBuilders can produce only a single instance of the collection they are growing.
Supertypes |
---|
Concrete methods
Source
Adds all elements produced by an IterableOnce to this growing builder.
Value parameters |
|
---|---|
Returns | the growing builder itself. |
Definition Classes | Growable |
Source
def addOne(elem: Elem): GrowableBuilder.this.type
Adds a single element to this growing builder.
Value parameters |
|
---|---|
Returns | the growing builder itself |
Source
Clears the contents of this builder. After execution of this method the builder will contain no elements.
Source
Returns | The number of elements in the collection under construction, if it can be cheaply computed, -1 otherwise. The default implementation always returns -1. |
---|---|
Definition Classes | Growable |
Source
def result(): To
Result collection consisting of all elements appended so far.
Inherited methods
Source
Alias for addAll
Inherited from | Growable |
---|
Source
Alias for addOne
Inherited from | Growable |
---|
Source
A builder resulting from this builder my mapping the result using f
.
Inherited from | Builder |
---|
Source
Gives a hint that one expects the result
of this builder to have the same size as the given collection, plus some delta. This will provide a hint only if the collection has a known size Some builder classes will optimize their representation based on the hint. However, builder implementations are still required to work correctly even if the hint is wrong, i.e. a different number of elements is added.
Value parameters |
|
---|---|
Inherited from | Builder |
Source
Gives a hint how many elements are expected to be added when the next result
is called. Some builder classes will optimize their representation based on the hint. However, builder implementations are still required to work correctly even if the hint is wrong, i.e. a different number of elements is added.
Value parameters |
|
---|---|
Inherited from | Builder |
Source
Gives a hint how many elements are expected to be added when the next result
is called, together with an upper bound given by the size of some other collection. Some builder classes will optimize their representation based on the hint. However, builder implementations are still required to work correctly even if the hint is wrong, i.e. a different number of elements is added.
Value parameters |
|
---|---|
Inherited from | Builder |
© 2002-2022 EPFL, with contributions from Lightbend.
Licensed under the Apache License, Version 2.0.
https://scala-lang.org/api/3.2.0/scala/collection/mutable/GrowableBuilder.html