1
1
package edu .stanford .nlp .util ;
2
2
3
- import java .io .DataInputStream ;
4
3
import java .io .DataOutputStream ;
4
+ import java .io .Serial ;
5
5
import java .io .Serializable ;
6
6
import java .util .Comparator ;
7
7
import java .util .List ;
@@ -105,10 +105,10 @@ public static <X, Y> Pair<X, Y> makePair(X x, Y y) {
105
105
106
106
/**
107
107
* Write a string representation of a Pair to a DataStream.
108
- * The < code> toString()</code> method is called on each of the pair
109
- * of objects and a < code> String</code> representation is written.
108
+ * The {@ code toString()} method is called on each of the pair
109
+ * of objects and a {@ code String} representation is written.
110
110
* This might not allow one to recover the pair of objects unless they
111
- * are of type < code> String</code> .
111
+ * are of type {@ code String} .
112
112
*/
113
113
public void save (DataOutputStream out ) {
114
114
try {
@@ -120,24 +120,24 @@ public void save(DataOutputStream out) {
120
120
}
121
121
122
122
/**
123
- * Compares this < code> Pair</code> to another object.
124
- * If the object is a < code> Pair</code> , this function will work providing
125
- * the elements of the < code> Pair</code> are themselves comparable.
123
+ * Compares this {@ code Pair} to another object.
124
+ * If the object is a {@ code Pair} , this function will work providing
125
+ * the elements of the {@ code Pair} are themselves comparable.
126
126
* It will then return a value based on the pair of objects, where
127
127
* <code>p > q iff p.first() > q.first() ||
128
128
* (p.first().equals(q.first()) && p.second() > q.second())</code>.
129
- * If the other object is not a < code> Pair</code> , it throws a
130
- * < code> ClassCastException</code> .
129
+ * If the other object is not a {@ code Pair} , it throws a
130
+ * {@ code ClassCastException} .
131
131
*
132
132
* @param another the <code>Object</code> to be compared.
133
133
* @return the value <code>0</code> if the argument is a
134
- * < code> Pair</code> equal to this < code> Pair</code> ; a value less than
135
- * <code>0</code> if the argument is a < code> Pair</code>
136
- * greater than this < code> Pair</code> ; and a value
134
+ * {@ code Pair} equal to this {@ code Pair} ; a value less than
135
+ * <code>0</code> if the argument is a {@ code Pair}
136
+ * greater than this {@ code Pair} ; and a value
137
137
* greater than <code>0</code> if the argument is a
138
- * < code> Pair</code> less than this < code> Pair</code> .
138
+ * {@ code Pair} less than this {@ code Pair} .
139
139
* @throws ClassCastException if the argument is not a
140
- * < code> Pair</code> .
140
+ * {@ code Pair} .
141
141
* @see java.lang.Comparable
142
142
*/
143
143
@ SuppressWarnings ("unchecked" )
@@ -196,6 +196,7 @@ public static Pair<String, String> internedStringPair(String first, String secon
196
196
/**
197
197
* use serialVersionUID for cross version serialization compatibility
198
198
*/
199
+ @ Serial
199
200
private static final long serialVersionUID = 1360822168806852921L ;
200
201
201
202
@@ -211,6 +212,7 @@ private MutableInternedPair(String first, String second) {
211
212
internStrings ();
212
213
}
213
214
215
+ @ Serial
214
216
protected Object readResolve () {
215
217
internStrings ();
216
218
return this ;
@@ -226,6 +228,7 @@ private void internStrings() {
226
228
}
227
229
228
230
// use serialVersionUID for cross version serialization compatibility
231
+ @ Serial
229
232
private static final long serialVersionUID = 1360822168806852922L ;
230
233
231
234
}
@@ -238,10 +241,10 @@ public void prettyLog(RedwoodChannels channels, String description) {
238
241
}
239
242
240
243
/**
241
- * Compares a < code> Pair</code> to another < code> Pair</code> according to the first object of the pair only
242
- * This function will work providing
243
- * the first element of the <code>Pair</code> is comparable, otherwise will throw a
244
- * <code>ClassCastException</code>
244
+ * Compares a {@ code Pair} to another {@ code Pair} according to the first object of the pair only
245
+ * This function will work providing the first element of the {@code Pair} is comparable,
246
+ * otherwise will throw a {@code ClassCastException}.
247
+ *
245
248
* @author jonathanberant
246
249
*/
247
250
public static class ByFirstPairComparator <T1 ,T2 > implements Comparator <Pair <T1 ,T2 >> {
@@ -254,9 +257,9 @@ public int compare(Pair<T1, T2> pair1, Pair<T1, T2> pair2) {
254
257
}
255
258
256
259
/**
257
- * Compares a < code> Pair</code> to another < code> Pair</code> according to the first object of the pair only in decreasing order
260
+ * Compares a {@ code Pair} to another {@ code Pair} according to the first object of the pair only in decreasing order
258
261
* This function will work providing
259
- * the first element of the < code> Pair</code> is comparable, otherwise will throw a
262
+ * the first element of the {@ code Pair} is comparable, otherwise will throw a
260
263
* <code>ClassCastException</code>
261
264
* @author jonathanberant
262
265
*/
@@ -270,9 +273,9 @@ public int compare(Pair<T1, T2> pair1, Pair<T1, T2> pair2) {
270
273
}
271
274
272
275
/**
273
- * Compares a < code> Pair</code> to another < code> Pair</code> according to the second object of the pair only
276
+ * Compares a {@ code Pair} to another {@ code Pair} according to the second object of the pair only
274
277
* This function will work providing
275
- * the first element of the < code> Pair</code> is comparable, otherwise will throw a
278
+ * the first element of the {@ code Pair} is comparable, otherwise will throw a
276
279
* <code>ClassCastException</code>
277
280
* @author jonathanberant
278
281
*/
@@ -286,10 +289,11 @@ public int compare(Pair<T1, T2> pair1, Pair<T1, T2> pair2) {
286
289
}
287
290
288
291
/**
289
- * Compares a < code> Pair</code> to another < code> Pair</code> according to the second object of the pair only in decreasing order
292
+ * Compares a {@ code Pair} to another {@ code Pair} according to the second object of the pair only in decreasing order
290
293
* This function will work providing
291
- * the first element of the < code> Pair</code> is comparable, otherwise will throw a
294
+ * the first element of the {@ code Pair} is comparable, otherwise will throw a
292
295
* <code>ClassCastException</code>
296
+ *
293
297
* @author jonathanberant
294
298
*/
295
299
public static class BySecondReversePairComparator <T1 ,T2 > implements Comparator <Pair <T1 ,T2 >> {
0 commit comments