blob: c5febe5fc2e84cf0faf3ffb7668159e487db59fc (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
|
/* __ *\
** ________ ___ / / ___ Scala API **
** / __/ __// _ | / / / _ | (c) 2003-2010, LAMP/EPFL **
** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ **
** /____/\___/_/ |_/____/_/ | | **
** |/ **
\* */
// $Id$
package scala.collection
package generic
/** This class represents collections that can be augmented using a `+=` operator
* and that can be cleared of all elements using the `clear` method.
*
* @author Martin Odersky
* @owner Martin Odersky
* @version 2.8
* @since 2.8
*/
trait Growable[-A] {
/** Adds a single element to this collection.
*
* @param elem the element to add.
*/
def +=(elem: A): this.type
/** Adds two or more elements to this collection.
*
* @param elem1 the first element to add.
* @param elem2 the second element to add.
* @param elems the remaining elements to add.
*/
def +=(elem1: A, elem2: A, elems: A*): this.type = this += elem1 += elem2 ++= elems
/** Adds a number of elements provided by an iterator to this collection.
*
* @param iter the iterator.
*/
def ++=(iter: Iterator[A]): this.type = { iter foreach += ; this }
/** Adds a number of elements provided by an iterable object to this collection.
*
* @param iter the iterable object.
*/
def ++=(iter: Traversable[A]): this.type = { iter foreach +=; this }
/** Clears the collection contents.
*/
def clear()
}
|