21
21
22
22
import java .io .IOException ;
23
23
import java .util .ArrayList ;
24
- import java .util .Comparator ;
25
24
import java .util .Iterator ;
26
25
import java .util .List ;
27
26
import java .util .Objects ;
28
- import java .util .Set ;
29
27
import java .util .function .Consumer ;
30
28
31
29
import static java .util .Collections .unmodifiableList ;
@@ -116,7 +114,7 @@ public Version getMinimalSupportedVersion() {
116
114
return Version .CURRENT .minimumCompatibilityVersion ();
117
115
}
118
116
119
- public SnapshotDeletionsPending withRemovedSnapshots (Set <SnapshotId > snapshotIds ) {
117
+ public SnapshotDeletionsPending withRemovedSnapshots (List <SnapshotId > snapshotIds ) {
120
118
if (snapshotIds == null || snapshotIds .isEmpty ()) {
121
119
return this ;
122
120
}
@@ -142,23 +140,19 @@ public SnapshotDeletionsPending withRemovedSnapshots(Set<SnapshotId> snapshotIds
142
140
public String toString () {
143
141
final StringBuilder builder = new StringBuilder ("SnapshotDeletionsPending[" );
144
142
boolean prepend = true ;
145
-
146
143
final Iterator <Entry > iterator = entries .stream ().iterator ();
147
144
while (iterator .hasNext ()) {
148
145
if (prepend == false ) {
149
146
builder .append (',' );
150
147
}
151
- final Entry entry = iterator .next ();
152
- builder .append ('[' ).append (entry .repositoryName ).append ('/' ).append (entry .repositoryUuid ).append (']' );
153
- builder .append ('[' ).append (entry .snapshotId ).append (',' ).append (entry .creationTime ).append (']' );
154
- builder .append ('\n' );
148
+ builder .append (iterator .next ());
155
149
prepend = false ;
156
150
}
157
151
builder .append (']' );
158
152
return builder .toString ();
159
153
}
160
154
161
- public static class Entry implements Writeable , ToXContentObject , Comparable < Entry > {
155
+ public static class Entry implements Writeable , ToXContentObject {
162
156
163
157
private final String repositoryName ;
164
158
private final String repositoryUuid ;
@@ -233,11 +227,8 @@ public XContentBuilder toXContent(XContentBuilder builder, Params params) throws
233
227
}
234
228
235
229
@ Override
236
- public int compareTo (final Entry other ) {
237
- return Comparator .comparingLong (Entry ::getCreationTime )
238
- .reversed ()
239
- .thenComparing (Entry ::getSnapshotId )
240
- .compare (this , other );
230
+ public String toString () {
231
+ return '[' + repositoryName + '/' + repositoryUuid + ',' + snapshotId + ',' + creationTime + ']' ;
241
232
}
242
233
}
243
234
0 commit comments