+/*
+ * Copyright (C) 2018 Free Software Foundation
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+package org.mxchange.jproduct.model.category;
+
+import java.io.Serializable;
+import java.util.Objects;
+
+/**
+ * An utilities class for product categories
+ * <p>
+ * @author Roland Häder<roland@mxchange.org>
+ */
+public class Categories implements Serializable {
+
+ /**
+ * Serial number
+ */
+ private static final long serialVersionUID = 157_687_661_634_901L;
+
+ /**
+ * Compares both Category instances. This method returns -1 if second
+ * instance is null.
+ * <p>
+ * @param category1 Category instance 1
+ * @param category2 Category instance 2
+ * <p>
+ * @return Comparison value
+ */
+ public static int compare (final Category category1, final Category category2) {
+ // Check euqality, then at least first must be given
+ if (Objects.equals(category1, category2)) {
+ // Both are same
+ return 0;
+ } else if (null == category1) {
+ // First is null
+ return -1;
+ } else if (null == category2) {
+ // Second is null
+ return 1;
+ }
+
+ // Invoke compareTo() method
+ return category1.compareTo(category2);
+ }
+
+ /**
+ * Utility classes should have no instances
+ */
+ private Categories () {
+ // Private constructor
+ }
+
+}