-
Notifications
You must be signed in to change notification settings - Fork 587
/
primitiveObjectMap.stg
150 lines (128 loc) · 5.51 KB
/
primitiveObjectMap.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
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
import "copyrightAndOthers.stg"
skipBoolean() ::= "true"
targetPath() ::= "org/eclipse/collections/api/map/primitive"
fileName(primitive) ::= "<primitive.name>ObjectMap"
class(primitive) ::= <<
<body(primitive.type, primitive.name)>
>>
body(type, name) ::= <<
<copyrightAndOthers()>
package org.eclipse.collections.api.map.primitive;
import org.eclipse.collections.api.Lazy<name>Iterable;
import org.eclipse.collections.api.RichIterable;
import org.eclipse.collections.api.block.function.Function0;
import org.eclipse.collections.api.block.predicate.primitive.<name>ObjectPredicate;
import org.eclipse.collections.api.block.procedure.Procedure;
import org.eclipse.collections.api.block.procedure.primitive.<name>ObjectProcedure;
import org.eclipse.collections.api.block.procedure.primitive.<name>Procedure;
import org.eclipse.collections.api.block.function.primitive.Object<name>ObjectToObjectFunction;
import org.eclipse.collections.api.set.primitive.Mutable<name>Set;
import org.eclipse.collections.api.tuple.primitive.<name>ObjectPair;
/**
* This file was automatically generated from template file primitiveObjectMap.stg.
*
* @since 3.0.
*/
public interface <name>ObjectMap\<V> extends PrimitiveObjectMap\<V>
{
/**
* Retrieves the value associated with the key. If no mapping exists for the key,
* {@code null} is returned.
* @param key the key
* @return the value associated with the key, or the default value if no such
* mapping exists
*/
V get(<type> key);
/**
* Retrieves the value associated with the key if one exists; if it does not,
* returns the result of invoking the value supplier.
* @param key the key
* @param function the supplier that provides the value if no mapping exists for {@code key}
* @return the value associated with the key, if one exists, or the result of
* invoking {@code ifAbsent} if not
*/
V getIfAbsent(<type> key, Function0\<? extends V> ifAbsent);
/**
* Returns whether or not the key is present in the map.
* @param key the key
* @return if a mapping exists in this map for the key
*/
boolean containsKey(<type> key);
@Override
<name>ObjectMap\<V> tap(Procedure\<? super V> procedure);
/**
* Iterates through each key in the map, invoking the procedure for each.
* @param procedure the procedure to invoke for each key
*/
void forEachKey(<name>Procedure procedure);
/**
* Iterates through each key/value pair in the map, invoking the procedure for each.
* @param procedure the procedure to invoke for each key/value pair
*/
void forEachKeyValue(<name>ObjectProcedure\<? super V> procedure);
/**
* Implements the injectInto pattern with each key/value pair of the map.
* @param value to be injected into the map
* @param function to apply to the injected value and key/value pairs
* @return result of injecting the injectedValue into the map
* @since 11.1
*/
default \<IV> IV injectIntoKeyValue(IV injectedValue, Object<name>ObjectToObjectFunction\<? super IV, ? super V, ? extends IV> function)
{
IV[] result = (IV[]) new Object[]{injectedValue};
this.forEachKeyValue((key, value) -> result[0] = function.valueOf(result[0], key, value));
return result[0];
}
/**
* Return a copy of this map containing only the key/value pairs that match the predicate.
* @param predicate the predicate to determine which key/value pairs in this map should be
* included in the returned map
* @return a copy of this map with the matching key/value pairs
*/
<name>ObjectMap\<V> select(<name>ObjectPredicate\<? super V> predicate);
/**
* Return a copy of this map containing only the key/value pairs that do not match the
* predicate.
* @param predicate the predicate to determine which key/value pairs in this map should be
* excluded from the returned map
* @return a copy of this map without the matching key/value pairs
*/
<name>ObjectMap\<V> reject(<name>ObjectPredicate\<? super V> predicate);
/**
* Returns a copy of this map that is immutable (if this map is mutable) or
* itself if it is already immutable.
* @return an immutable map that is equivalent to this one
*/
Immutable<name>ObjectMap\<V> toImmutable();
/**
* Returns a set containing all the keys in this map. The set is backed by the
* map, so any modifications to the returned set will affect this map.
* @return a mutable set containing the keys in this map
*/
Mutable<name>Set keySet();
/**
* Returns a view of the keys in this map. This iterable is backed by the map, so
* any modifications to the underlying map will be reflected in the keys returned
* by the iterable.
* @return a view of the keys in this map
* @since 5.0
*/
Lazy<name>Iterable keysView();
/**
* Returns a view of the key/value pairs in this map. This iterable is backed by
* the map, so any modifications to the underlying map will be reflected in the
* pairs returned by the iterable.
* @return a view of the keys in this map
* @since 5.0
*/
RichIterable\<<name>ObjectPair\<V>\> keyValuesView();
/**
* Return the Object<name>Map that is obtained by flipping the direction of this map and making the associations
* from value to key.
*
* @throws IllegalStateException if the Object<name>Map contains duplicate values.
* @since 9.0
*/
Object<name>Map\<V> flipUniqueValues();
}
>>