-
Notifications
You must be signed in to change notification settings - Fork 587
/
mutablePrimitiveCollection.stg
112 lines (84 loc) · 2.71 KB
/
mutablePrimitiveCollection.stg
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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
import "copyrightAndOthers.stg"
import "primitiveAPI.stg"
targetPath() ::= "org/eclipse/collections/api/collection/primitive"
fileName(primitive) ::= "Mutable<primitive.name>Collection"
class(primitive) ::= <<
<body(primitive.type, primitive.name, primitive)>
>>
body(type, name, primitive) ::= <<
<copyrightAndOthers()>
package org.eclipse.collections.api.collection.primitive;
import java.util.Collection;
import org.eclipse.collections.api.<name>Iterable;
import org.eclipse.collections.api.block.function.primitive.<name>ToObjectFunction;
import org.eclipse.collections.api.block.predicate.primitive.<name>Predicate;
import org.eclipse.collections.api.block.procedure.primitive.<name>Procedure;
import org.eclipse.collections.api.iterator.Mutable<name>Iterator;
import org.eclipse.collections.api.collection.MutableCollection;
/**
* This file was automatically generated from template file mutablePrimitiveCollection.stg.
*
* @since 3.0.
*/
public interface Mutable<name>Collection extends <name>Iterable
{
@Override
Mutable<name>Iterator <type>Iterator();
boolean add(<type> element);
boolean addAll(<type>... source);
boolean addAll(<name>Iterable source);
boolean remove(<type> value);
boolean removeAll(<name>Iterable source);
boolean removeAll(<type>... source);
/**
* @since 9.1
*/
default boolean removeIf(<name>Predicate predicate)
{
boolean changed = false;
for (Mutable<name>Iterator iterator = this.<type>Iterator(); iterator.hasNext();)
{
if (predicate.accept(iterator.next()))
{
iterator.remove();
changed = true;
}
}
return changed;
}
/**
* @see Collection#retainAll(Collection)
* @since 5.0
*/
boolean retainAll(<name>Iterable elements);
/**
* @see Collection#retainAll(Collection)
* @since 5.0
*/
boolean retainAll(<type>... source);
void clear();
<sharedAPI(fileName(primitive), name)>
\<V> MutableCollection\<V> collect(<name>ToObjectFunction\<? extends V> function);
<mutableAPINoOverride(fileName(primitive), type, name)>
Mutable<name>Collection asUnmodifiable();
Mutable<name>Collection asSynchronized();
Immutable<name>Collection toImmutable();
/**
* @since 9.0.
*/
@Override
default Mutable<name>Collection tap(<name>Procedure procedure)
{
this.forEach(procedure);
return this;
}
/**
* Creates a new empty mutable version of the same collection type.
* @since 9.2.
*/
default Mutable<name>Collection newEmpty()
{
throw new UnsupportedOperationException("Implement in concrete classes.");
}
}
>>