From a44cda2cacde831d82975c63933c2c83c13a1166 Mon Sep 17 00:00:00 2001 From: Jonathan Bauer Date: Fri, 2 Sep 2016 18:35:29 +0200 Subject: added new comparator for sorting OS by name --- src/main/java/org/openslx/thrifthelper/Comparators.java | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/main/java/org/openslx/thrifthelper/Comparators.java b/src/main/java/org/openslx/thrifthelper/Comparators.java index ec42966..fa16eb4 100644 --- a/src/main/java/org/openslx/thrifthelper/Comparators.java +++ b/src/main/java/org/openslx/thrifthelper/Comparators.java @@ -53,6 +53,18 @@ public class Comparators } }; + public static final Comparator operatingSystemByName = new Comparator() { + @Override + public int compare( OperatingSystem o1, OperatingSystem o2 ) + { + if ( o1 == null ) + return o2 == null ? 0 : 1; + if ( o2 == null ) + return -1; + return o1.osName.compareTo(o2.osName); + } + }; + public static final Comparator virtualizer = new Comparator() { @Override public int compare( Virtualizer o1, Virtualizer o2 ) -- cgit v1.2.3-55-g7522