2121
2222import java .io .IOException ;
2323import java .util .ArrayList ;
24- import java .util .Comparator ;
2524import java .util .Iterator ;
2625import java .util .List ;
2726import java .util .Objects ;
28- import java .util .Set ;
2927import java .util .function .Consumer ;
3028
3129import static java .util .Collections .unmodifiableList ;
@@ -116,7 +114,7 @@ public Version getMinimalSupportedVersion() {
116114 return Version .CURRENT .minimumCompatibilityVersion ();
117115 }
118116
119- public SnapshotDeletionsPending withRemovedSnapshots (Set <SnapshotId > snapshotIds ) {
117+ public SnapshotDeletionsPending withRemovedSnapshots (List <SnapshotId > snapshotIds ) {
120118 if (snapshotIds == null || snapshotIds .isEmpty ()) {
121119 return this ;
122120 }
@@ -142,23 +140,19 @@ public SnapshotDeletionsPending withRemovedSnapshots(Set<SnapshotId> snapshotIds
142140 public String toString () {
143141 final StringBuilder builder = new StringBuilder ("SnapshotDeletionsPending[" );
144142 boolean prepend = true ;
145-
146143 final Iterator <Entry > iterator = entries .stream ().iterator ();
147144 while (iterator .hasNext ()) {
148145 if (prepend == false ) {
149146 builder .append (',' );
150147 }
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 ());
155149 prepend = false ;
156150 }
157151 builder .append (']' );
158152 return builder .toString ();
159153 }
160154
161- public static class Entry implements Writeable , ToXContentObject , Comparable < Entry > {
155+ public static class Entry implements Writeable , ToXContentObject {
162156
163157 private final String repositoryName ;
164158 private final String repositoryUuid ;
@@ -233,11 +227,8 @@ public XContentBuilder toXContent(XContentBuilder builder, Params params) throws
233227 }
234228
235229 @ 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 + ']' ;
241232 }
242233 }
243234
0 commit comments