-
Notifications
You must be signed in to change notification settings - Fork 970
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Convert more classes to record classes #13328
base: main
Are you sure you want to change the base?
Changes from 1 commit
299d344
399c9f9
71bf91b
42680f1
dd8f467
7e4aacb
5addff7
0c91d18
31c8850
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,7 +24,6 @@ | |
import java.util.Comparator; | ||
import java.util.LinkedHashSet; | ||
import java.util.List; | ||
import java.util.Objects; | ||
import java.util.PriorityQueue; | ||
import java.util.Set; | ||
import java.util.TreeSet; | ||
|
@@ -447,14 +446,8 @@ private static int commonCharacterPositionScore(String s1, String s2) { | |
return commonScore; | ||
} | ||
|
||
private static class Weighted<T extends Comparable<T>> implements Comparable<Weighted<T>> { | ||
final T word; | ||
final int score; | ||
|
||
Weighted(T word, int score) { | ||
this.word = word; | ||
this.score = score; | ||
} | ||
private record Weighted<T extends Comparable<T>>(T word, int score) | ||
implements Comparable<Weighted<T>> { | ||
|
||
@Override | ||
public boolean equals(Object o) { | ||
|
@@ -465,11 +458,6 @@ public boolean equals(Object o) { | |
return score == that.score && word.equals(that.word); | ||
} | ||
|
||
@Override | ||
public int hashCode() { | ||
return Objects.hash(word, score); | ||
} | ||
|
||
@Override | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. let's keep that one, as the toString output is different from default |
||
public String toString() { | ||
return word + "(" + score + ")"; | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,14 +18,13 @@ | |
|
||
import org.apache.lucene.util.BytesRef; | ||
|
||
/** Wraps a term and boost */ | ||
public class TermAndBoost { | ||
/** the term */ | ||
public final BytesRef term; | ||
|
||
/** the boost */ | ||
public final float boost; | ||
|
||
/** | ||
* Wraps a term and boost | ||
* | ||
* @param term the term | ||
* @param boost the boost | ||
*/ | ||
public record TermAndBoost(BytesRef term, float boost) { | ||
/** Creates a new TermAndBoost */ | ||
public TermAndBoost(BytesRef term, float boost) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this can be converted to the generic ctor without parameters: public TermAndBoost {
term = BytesRef.deepCopyOf(term);
} There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done!.....I changed others such occurrences that I could find as well |
||
this.term = BytesRef.deepCopyOf(term); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
needs to be removed, too