-
Notifications
You must be signed in to change notification settings - Fork 587
/
immutablePrimitiveList.stg
126 lines (107 loc) · 3.97 KB
/
immutablePrimitiveList.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
import "copyrightAndOthers.stg"
import "primitiveAPI.stg"
targetPath() ::= "org/eclipse/collections/api/list/primitive"
fileName(primitive) ::= "Immutable<primitive.name>List"
class(primitive) ::= <<
<body(primitive.type, primitive.name)>
>>
body(type, name) ::= <<
<copyrightAndOthers()>
package org.eclipse.collections.api.list.primitive;
import org.eclipse.collections.api.<name>Iterable;
import org.eclipse.collections.api.block.function.primitive.<name>IntToObjectFunction;
import org.eclipse.collections.api.block.function.primitive.<name>ToObjectFunction;
import org.eclipse.collections.api.block.predicate.primitive.<name>IntPredicate;
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.collection.primitive.Immutable<name>Collection;
import org.eclipse.collections.api.list.ImmutableList;
import org.eclipse.collections.api.tuple.primitive.<name><name>Pair;
import org.eclipse.collections.api.tuple.primitive.<name>ObjectPair;
/**
* This file was automatically generated from template file immutablePrimitiveList.stg.
*
* @since 3.0.
*/
public interface Immutable<name>List extends Immutable<name>Collection, <name>List
{
<sharedAPI(fileName(primitive), name)>
/**
* @since 9.0.
*/
@Override
default Immutable<name>List tap(<name>Procedure procedure)
{
this.forEach(procedure);
return this;
}
/**
* Returns a new Immutable<name>List including all elements with corresponding indexes matching the specified predicate.
*
* @since 11.1.
*/
@Override
default Immutable<name>List selectWithIndex(<name>IntPredicate predicate)
{
int[] index = {0};
return this.select(each -> predicate.accept(each, index[0]++));
}
/**
* Returns a new Immutable<name>List excluding all elements with corresponding indexes matching the specified predicate.
*
* @since 11.1.
*/
@Override
default Immutable<name>List rejectWithIndex(<name>IntPredicate predicate)
{
int[] index = {0};
return this.reject(each -> predicate.accept(each, index[0]++));
}
@Override
\<V> ImmutableList\<V> collect(<name>ToObjectFunction\<? extends V> function);
/**
* Returns a new ImmutableList using results obtained by applying the specified function to each element
* and its corresponding index.
*
* @since 9.1.
*/
@Override
default \<V> ImmutableList\<V> collectWithIndex(<name>IntToObjectFunction\<? extends V> function)
{
int[] index = {0};
return this.collect(each -> function.value(each, index[0]++));
}
<immutableAPI(fileName(primitive), type, name)>
@Override
Immutable<name>List toReversed();
/**
* @since 6.0.
*/
@Override
Immutable<name>List distinct();
@Override
Immutable<name>List subList(int fromIndex, int toIndex);
/**
* Returns an {@code ImmutableList} formed from this {@code Immutable<name>List} and another {@code <name>List} by
* combining corresponding elements in pairs. If one of the two {@code <name>List}s is longer than the other, its
* remaining elements are ignored.
*
* @since 9.1.
*/
default ImmutableList\<<name><name>Pair> zip<name>(<name>Iterable iterable)
{
throw new UnsupportedOperationException("Default method to prevent breaking backwards compatibility");
}
/**
* Returns an {@code ImmutableList} formed from this {@code Immutable<name>List} and a {@code ListIterable} by
* combining corresponding elements in pairs. If one of the two Lists is longer than the other, its
* remaining elements are ignored.
*
* @since 9.1.
*/
default \<T> ImmutableList\<<name>ObjectPair\<T\>> zip(Iterable\<T> iterable)
{
throw new UnsupportedOperationException("Default method to prevent breaking backwards compatibility");
}
}
>>