2 * Copyright (C) 2018 Free Software Foundation
4 * This program is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation, either version 3 of the License, or
7 * (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program. If not, see <http://www.gnu.org/licenses/>.
17 package org.mxchange.jcontactsbusiness.model.jobposition;
19 import java.io.Serializable;
20 import java.util.Objects;
23 * Utilities class for job positions
25 * @author Roland Häder<roland@mxchange.org>
27 public class JobPositions implements Serializable {
32 private static final long serialVersionUID = 157_986_766_142_309L;
35 * Compares both job position instances. This method returns -1 if second
38 * @param jobPosition1 Job position instance 1
39 * @param jobPosition2 Job position instance 2
41 * @return Comparison value
43 * @throws NullPointerException If first instance is null
45 public static int compare (final JobPosition jobPosition1, final JobPosition jobPosition2) {
46 // Check euqality, then at least first must be given
47 if (Objects.equals(jobPosition1, jobPosition2)) {
50 } else if (null == jobPosition1) {
51 // First cannot be null
52 throw new NullPointerException("jobPosition1 is null"); //NOI18N
53 } else if (null == jobPosition2) {
58 // Invoke compareTo() method
59 return jobPosition1.compareTo(jobPosition2);
65 private JobPositions () {
66 // No instance should be creatable