Project

General

Profile

Download (807 Bytes) Statistics
| Branch: | Tag: | Revision:
1
/**
2
* Copyright (C) 2020 EDIT
3
* European Distributed Institute of Taxonomy
4
* http://www.e-taxonomy.eu
5
*
6
* The contents of this file are subject to the Mozilla Public License Version 1.1
7
* See LICENSE.TXT at the top of this package for the full license terms.
8
*/
9
package eu.etaxonomy.cdm.common;
10

    
11
import java.util.Comparator;
12

    
13
/**
14
 * @author a.mueller
15
 * @since 10.01.2020
16
 */
17
public class StringComparator implements Comparator<String> {
18

    
19
    public static final StringComparator Instance = new StringComparator();
20

    
21
    @Override
22
    public int compare(String str1, String str2) {
23

    
24
        if (str1 == str2) {
25
            return 0;
26
        }
27
        if (str1 == null) {
28
            return -1;
29
        }
30
        if (str2 == null) {
31
            return 1;
32
        }
33
        return str1.compareTo(str2);
34
    }
35
}
(17-17/25)