blob: 49e1b57eb6de3ae8e7456680a84dbb8bc8cb4ba5 (
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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
|
/* __ *\
** ________ ___ / / ___ Scala API **
** / __/ __// _ | / / / _ | (c) 2003-2009, LAMP/EPFL **
** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ **
** /____/\___/_/ |_/____/_/ | | **
** |/ **
\* */
// $Id: Iterable.scala 15188 2008-05-24 15:01:02Z stepancheg $
package scalax.collection.generic.mutable
/** This class represents collections that can be shrunk using a -= operator.
*
* @autor Martin Odersky
* @owner Martin Odersky
* @version 2.8
*/
trait Shrinkable[A] {
/** Remove a single element from this collection.
*
* @param elem the element to append.
*/
def -=(elem: A): Unit
/** Remove two or more elements from this collection.
* @param elem1 the first element.
* @param elem2 the second element.
* @param elems the remaining elements.
*/
def -= (elem1: A, elem2: A, elems: A*) {
this -= elem1
this -= elem2
this --= elems.asInstanceOf[Iterable[A]] // !@!
}
/** Remove all the elements provided by an iterable
* <code>elems</code> from the collection.
*/
def --=(elems: Iterable[A]) { elems foreach -= }
/** Remove all the elements provided by an iterator
* <code>elems</code> from the collection.
*/
def --=(elems: Iterator[A]) { elems foreach -= }
/** Remove a single element from the collection.
* @return the collection itself with the element removed.
*
* @param elem the element to be removed
*/
def - (elem: A): this.type = { -=(elem); this }
/** Remove two or more elements from this collection.
*
* @param elem1 the first element.
* @param elem2 the second element.
* @param elems the remaining elements.
* @return the collection itself with the elements removed.
*/
def - (elem1: A, elem2: A, elems: A*): this.type = { -=(elem1, elem2, elems: _*); this }
/** Remove all the elements provided by an iterator
* <code>elems</code> from the collection.
*
* @param elems An iterator containing the elements to remove from the collection.
* @return the collection itself with the elements removed.
*/
def -- (elems: Iterable[A]): this.type = { this --= elems; this }
/** Remove all the elements provided by an iterator
* <code>elems</code> from the collection.
*
* @param elems An iterator containing the elements to remove from the collection.
* @return the collection itself with the elements removed.
*/
def -- (elems: Iterator[A]): this.type = { this --= elems; this }
}
|