-
Notifications
You must be signed in to change notification settings - Fork 587
/
mutablePrimitiveObjectMapFactoryImpl.stg
91 lines (74 loc) · 2.58 KB
/
mutablePrimitiveObjectMapFactoryImpl.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
import "copyright.stg"
skipBoolean() ::= "true"
targetPath() ::= "org/eclipse/collections/impl/map/mutable/primitive"
fileName(primitive) ::= "Mutable<primitive.name>ObjectMapFactoryImpl"
class(primitive) ::= <<
<body(primitive.type, primitive.name)>
>>
body(type, name) ::= <<
<copyright()>
package org.eclipse.collections.impl.map.mutable.primitive;
import org.eclipse.collections.api.block.function.Function;
import org.eclipse.collections.api.block.function.primitive.<name>Function;
import org.eclipse.collections.api.factory.map.primitive.Mutable<name>ObjectMapFactory;
import org.eclipse.collections.api.map.primitive.Mutable<name>ObjectMap;
import org.eclipse.collections.api.map.primitive.<name>ObjectMap;
import org.eclipse.collections.impl.factory.primitive.<name>ObjectMaps;
import org.eclipse.collections.impl.utility.Iterate;
/**
* Mutable<name>ObjectMapFactoryImpl is a factory implementation which creates instances of type {@link Mutable<name>ObjectMap}.
* This file was automatically generated from template file mutablePrimitiveObjectMapFactoryImpl.stg.
*
* @since 6.0.
*/
public enum Mutable<name>ObjectMapFactoryImpl implements Mutable<name>ObjectMapFactory
{
INSTANCE;
@Override
public \<V> Mutable<name>ObjectMap\<V> empty()
{
return new <name>ObjectHashMap(0);
}
@Override
public \<V> Mutable<name>ObjectMap\<V> of()
{
return this.empty();
}
@Override
public \<V> Mutable<name>ObjectMap\<V> with()
{
return this.empty();
}
@Override
public \<V> Mutable<name>ObjectMap\<V> ofInitialCapacity(int capacity)
{
return this.withInitialCapacity(capacity);
}
@Override
public \<V> Mutable<name>ObjectMap\<V> withInitialCapacity(int capacity)
{
return new <name>ObjectHashMap\<>(capacity);
}
@Override
public \<V> Mutable<name>ObjectMap\<V> ofAll(<name>ObjectMap\<? extends V> map)
{
return this.withAll(map);
}
@Override
public \<V> Mutable<name>ObjectMap\<V> withAll(<name>ObjectMap\<? extends V> map)
{
if (map.isEmpty())
{
return this.empty();
}
return new <name>ObjectHashMap\<>(map);
}
@Override
public \<T, V> Mutable<name>ObjectMap\<V> from(Iterable\<T> iterable, <name>Function\<? super T> keyFunction, Function\<? super T, ? extends V> valueFunction)
{
Mutable<name>ObjectMap\<V> map = <name>ObjectMaps.mutable.empty();
Iterate.forEach(iterable, each -> map.put(keyFunction.<type>ValueOf(each), valueFunction.valueOf(each)));
return map;
}
}
>>