diff --git a/src/main/java/org/jabref/gui/entryeditor/SourceTab.java b/src/main/java/org/jabref/gui/entryeditor/SourceTab.java index 6161e3a24ed..26cf33bb55a 100644 --- a/src/main/java/org/jabref/gui/entryeditor/SourceTab.java +++ b/src/main/java/org/jabref/gui/entryeditor/SourceTab.java @@ -163,7 +163,6 @@ public int getLocationOffset(int x, int y) { @Override public void cancelLatestCommittedText() { - return; } @Override diff --git a/src/main/java/org/jabref/logic/importer/fileformat/MrDLibImporter.java b/src/main/java/org/jabref/logic/importer/fileformat/MrDLibImporter.java index a97bae7d049..c2879810f89 100644 --- a/src/main/java/org/jabref/logic/importer/fileformat/MrDLibImporter.java +++ b/src/main/java/org/jabref/logic/importer/fileformat/MrDLibImporter.java @@ -6,6 +6,7 @@ import java.io.BufferedReader; import java.io.IOException; import java.util.ArrayList; +import java.util.Comparator; import java.util.Iterator; import java.util.List; import java.util.stream.Collectors; @@ -91,15 +92,7 @@ private String convertToString(BufferedReader input) { /** * Small pair-class to ensure the right order of the recommendations. */ - private static class RankedBibEntry { - - public BibEntry entry; - public Integer rank; - - public RankedBibEntry(BibEntry entry, Integer rank) { - this.rank = rank; - this.entry = entry; - } + private record RankedBibEntry(BibEntry entry, Integer rank) { } /** @@ -126,8 +119,7 @@ private void parse(BufferedReader input) throws IOException { } // Sort bib entries according to rank - rankedBibEntries.sort((RankedBibEntry rankedBibEntry1, - RankedBibEntry rankedBibEntry2) -> rankedBibEntry1.rank.compareTo(rankedBibEntry2.rank)); + rankedBibEntries.sort(Comparator.comparing((RankedBibEntry rankedBibEntry) -> rankedBibEntry.rank)); List bibEntries = rankedBibEntries.stream().map(e -> e.entry).collect(Collectors.toList()); bibDatabase.insertEntries(bibEntries); diff --git a/src/main/java/org/jabref/logic/openoffice/action/EditMerge.java b/src/main/java/org/jabref/logic/openoffice/action/EditMerge.java index f87f3ae9038..1bd2f71b2ec 100644 --- a/src/main/java/org/jabref/logic/openoffice/action/EditMerge.java +++ b/src/main/java/org/jabref/logic/openoffice/action/EditMerge.java @@ -93,21 +93,11 @@ public static boolean mergeCitationGroups(XTextDocument doc, OOFrontend frontend return madeModifications; } - private static class JoinableGroupData { - /** - * A list of consecutive citation groups only separated by spaces. - */ - List group; - - /** - * A cursor covering the XTextRange of each entry in group (and the spaces between them) - */ - XTextCursor groupCursor; - - JoinableGroupData(List group, XTextCursor groupCursor) { - this.group = group; - this.groupCursor = groupCursor; - } + /** + * @param group A list of consecutive citation groups only separated by spaces. + * @param groupCursor A cursor covering the XTextRange of each entry in group (and the spaces between them) + */ + private record JoinableGroupData(List group, XTextCursor groupCursor) { } private static class ScanState { diff --git a/src/main/java/org/jabref/model/openoffice/rangesort/RangeSortVisual.java b/src/main/java/org/jabref/model/openoffice/rangesort/RangeSortVisual.java index 45692ed1703..88af7b426b1 100644 --- a/src/main/java/org/jabref/model/openoffice/rangesort/RangeSortVisual.java +++ b/src/main/java/org/jabref/model/openoffice/rangesort/RangeSortVisual.java @@ -67,7 +67,7 @@ public static List> visualSort(List> input // collect ordered result List> result = new ArrayList<>(comparableMarks.size()); for (ComparableMark> mark : comparableMarks) { - result.add(mark.getContent()); + result.add(mark.content()); } if (result.size() != inputSize) { @@ -111,20 +111,6 @@ private static int compareTopToBottomLeftToRight(ComparableMark a, Compar *

* Used for sorting reference marks by their visual positions. */ - private static class ComparableMark { - - private final Point position; - private final int indexInPosition; - private final T content; - - public ComparableMark(Point position, int indexInPosition, T content) { - this.position = position; - this.indexInPosition = indexInPosition; - this.content = content; - } - - public T getContent() { - return content; - } + private record ComparableMark(Point position, int indexInPosition, T content) { } }