From c95a6df304aa93393af25b62cbb8770fc8244405 Mon Sep 17 00:00:00 2001 From: Danila Fedorin Date: Tue, 8 Aug 2017 14:26:04 -0700 Subject: [PATCH] Change the sorting order. --- src/main/java/org/nwapw/abacus/fx/AbacusController.java | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/main/java/org/nwapw/abacus/fx/AbacusController.java b/src/main/java/org/nwapw/abacus/fx/AbacusController.java index 96f155e..ddd877a 100644 --- a/src/main/java/org/nwapw/abacus/fx/AbacusController.java +++ b/src/main/java/org/nwapw/abacus/fx/AbacusController.java @@ -7,6 +7,7 @@ import javafx.collections.FXCollections; import javafx.collections.ObservableList; import javafx.collections.transformation.FilteredList; import javafx.fxml.FXML; +import javafx.scene.Node; import javafx.scene.control.*; import javafx.scene.control.cell.CheckBoxListCell; import javafx.scene.text.Text; @@ -27,6 +28,7 @@ import org.nwapw.abacus.tree.TreeNode; import java.io.File; import java.io.IOException; import java.util.ArrayList; +import java.util.Comparator; import java.util.Set; import java.util.stream.Collectors; @@ -354,12 +356,7 @@ public class AbacusController implements PluginListener { PluginManager pluginManager = abacus.getPluginManager(); functionList.addAll(manager.getAllFunctions().stream().map(name -> pluginManager.documentationFor(name, DocumentationType.FUNCTION)) .collect(Collectors.toCollection(ArrayList::new))); - functionList.sort((a, b) -> { - if(a == null && b == null) return 0; - else if(a == null) return -1; - else if(b == null) return 1; - else return a.getCodeName().compareTo(b.getCodeName()); - }); + functionList.sort(Comparator.comparing(Documentation::getCodeName)); } @Override