Skip to content

Commit 8b833bb

Browse files
turbanoffchhagedorn
authored andcommitted
8274048: IGV: Replace usages of Collections.sort with List.sort call
Reviewed-by: chagedorn
1 parent a74c099 commit 8b833bb

File tree

8 files changed

+22
-24
lines changed

8 files changed

+22
-24
lines changed

src/utils/IdealGraphVisualizer/Data/src/main/java/com/sun/hotspot/igv/data/InputGraph.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2008, 2015, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2008, 2021, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -96,7 +96,7 @@ public Map<InputNode, List<InputEdge>> findAllOutgoingEdges() {
9696

9797
for(InputNode n : this.getNodes()) {
9898
List<InputEdge> list = result.get(n);
99-
Collections.sort(list, InputEdge.OUTGOING_COMPARATOR);
99+
list.sort(InputEdge.OUTGOING_COMPARATOR);
100100
}
101101

102102
return result;
@@ -118,7 +118,7 @@ public Map<InputNode, List<InputEdge>> findAllIngoingEdges() {
118118

119119
for(InputNode n : this.getNodes()) {
120120
List<InputEdge> list = result.get(n);
121-
Collections.sort(list, InputEdge.INGOING_COMPARATOR);
121+
list.sort(InputEdge.INGOING_COMPARATOR);
122122
}
123123

124124
return result;
@@ -133,7 +133,7 @@ public List<InputEdge> findOutgoingEdges(InputNode n) {
133133
}
134134
}
135135

136-
Collections.sort(result, InputEdge.OUTGOING_COMPARATOR);
136+
result.sort(InputEdge.OUTGOING_COMPARATOR);
137137

138138
return result;
139139
}

src/utils/IdealGraphVisualizer/Data/src/main/java/com/sun/hotspot/igv/data/Properties.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -312,7 +312,7 @@ public String toString() {
312312
}
313313
}
314314

315-
Collections.sort(pairs, new Comparator<String[]>() {
315+
pairs.sort(new Comparator<String[]>() {
316316
@Override
317317
public int compare(String[] o1, String[] o2) {
318318
assert o1.length == 2;

src/utils/IdealGraphVisualizer/FilterWindow/src/main/java/com/sun/hotspot/igv/filterwindow/FilterTopComponent.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2008, 2015, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2008, 2021, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -175,7 +175,7 @@ public void addFilterSetting() {
175175
filterSettings.add(setting);
176176

177177
// Sort alphabetically
178-
Collections.sort(filterSettings, new Comparator<FilterSetting>() {
178+
filterSettings.sort(new Comparator<FilterSetting>() {
179179

180180
@Override
181181
public int compare(FilterSetting o1, FilterSetting o2) {

src/utils/IdealGraphVisualizer/Graph/src/main/java/com/sun/hotspot/igv/graph/Diagram.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -284,7 +284,7 @@ public void printStatistics() {
284284
System.out.println("Number of connections: " + connections.size());
285285

286286
List<Figure> figuresSorted = new ArrayList<>(tmpFigures);
287-
Collections.sort(figuresSorted, new Comparator<Figure>() {
287+
figuresSorted.sort(new Comparator<Figure>() {
288288

289289
@Override
290290
public int compare(Figure a, Figure b) {

src/utils/IdealGraphVisualizer/Graph/src/main/java/com/sun/hotspot/igv/graph/Figure.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ public InputSlot createInputSlot() {
213213
public InputSlot createInputSlot(int index) {
214214
InputSlot slot = new InputSlot(this, index);
215215
inputSlots.add(slot);
216-
Collections.sort(inputSlots, Slot.slotIndexComparator);
216+
inputSlots.sort(Slot.slotIndexComparator);
217217
return slot;
218218
}
219219

@@ -242,7 +242,7 @@ public OutputSlot createOutputSlot() {
242242
public OutputSlot createOutputSlot(int index) {
243243
OutputSlot slot = new OutputSlot(this, index);
244244
outputSlots.add(slot);
245-
Collections.sort(outputSlots, Slot.slotIndexComparator);
245+
outputSlots.sort(Slot.slotIndexComparator);
246246
return slot;
247247
}
248248

src/utils/IdealGraphVisualizer/HierarchicalLayout/src/main/java/com/sun/hotspot/igv/hierarchicallayout/HierarchicalLayoutManager.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2008, 2015, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2008, 2021, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -614,8 +614,8 @@ protected void run() {
614614
upProcessingOrder[i].add(n);
615615
}
616616

617-
Collections.sort(downProcessingOrder[i], nodeProcessingDownComparator);
618-
Collections.sort(upProcessingOrder[i], nodeProcessingUpComparator);
617+
downProcessingOrder[i].sort(nodeProcessingDownComparator);
618+
upProcessingOrder[i].sort(nodeProcessingUpComparator);
619619
}
620620

621621
initialPositions();
@@ -924,7 +924,7 @@ private void downSweep() {
924924
}
925925

926926
updateCrossingNumbers(i, true);
927-
Collections.sort(layers[i], crossingNodeComparator);
927+
layers[i].sort(crossingNodeComparator);
928928
updateXOfLayer(i);
929929

930930
int z = 0;
@@ -995,7 +995,7 @@ private void upSweep() {
995995
}
996996

997997
updateCrossingNumbers(i, false);
998-
Collections.sort(layers[i], crossingNodeComparator);
998+
layers[i].sort(crossingNodeComparator);
999999
updateXOfLayer(i);
10001000

10011001
int z = 0;
@@ -1185,7 +1185,7 @@ public int compare(LayoutEdge e1, LayoutEdge e2) {
11851185
if (portHash.containsKey(i)) {
11861186

11871187
List<LayoutEdge> list = portHash.get(i);
1188-
Collections.sort(list, comparator);
1188+
list.sort(comparator);
11891189

11901190
if (list.size() == 1) {
11911191
processSingleEdge(list.get(0));
@@ -1749,7 +1749,7 @@ protected void run() {
17491749

17501750
// Set up edges
17511751
List<Link> links = new ArrayList<>(graph.getLinks());
1752-
Collections.sort(links, linkComparator);
1752+
links.sort(linkComparator);
17531753
for (Link l : links) {
17541754
LayoutEdge edge = new LayoutEdge();
17551755
assert vertexToLayoutNode.containsKey(l.getFrom().getVertex());

src/utils/IdealGraphVisualizer/ServerCompiler/src/main/java/com/sun/hotspot/igv/servercompiler/ServerCompilerScheduler.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -637,7 +637,7 @@ public void buildUpGraph() {
637637
for (Integer i : edgeMap.keySet()) {
638638

639639
List<InputEdge> list = edgeMap.get(i);
640-
Collections.sort(list, edgeComparator);
640+
list.sort(edgeComparator);
641641

642642
int to = i;
643643
InputNode toInputNode = graph.getNode(to);

src/utils/IdealGraphVisualizer/View/src/main/java/com/sun/hotspot/igv/view/NodeQuickSearch.java

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@
3030
import com.sun.hotspot.igv.data.services.InputGraphProvider;
3131
import com.sun.hotspot.igv.settings.Settings;
3232
import com.sun.hotspot.igv.util.LookupHistory;
33-
import java.util.Collections;
3433
import java.util.HashSet;
3534
import java.util.List;
3635
import java.util.Set;
@@ -135,11 +134,10 @@ public void run() {
135134
}
136135

137136
// Rank the matches.
138-
Collections.sort(matches,
139-
(InputNode a, InputNode b) ->
140-
compareByRankThenNumVal(rawValue,
141-
a.getProperties().get(name),
142-
b.getProperties().get(name)));
137+
matches.sort((InputNode a, InputNode b) ->
138+
compareByRankThenNumVal(rawValue,
139+
a.getProperties().get(name),
140+
b.getProperties().get(name)));
143141

144142
// Single matches
145143
for (final InputNode n : matches) {

0 commit comments

Comments
 (0)