Project

General

Profile

« Previous | Next » 

Revision 0e6281ce

Added by Katja Luther almost 8 years ago

add TermIdInVocabularyComparator

View differences:

cdmlib-model/src/main/java/eu/etaxonomy/cdm/model/common/TermIdInVocabularyComparator.java
1
// $Id$
2
/**
3
* Copyright (C) 2016 EDIT
4
* European Distributed Institute of Taxonomy
5
* http://www.e-taxonomy.eu
6
*
7
* The contents of this file are subject to the Mozilla Public License Version 1.1
8
* See LICENSE.TXT at the top of this package for the full license terms.
9
*/
10
package eu.etaxonomy.cdm.model.common;
11

  
12
import java.util.Comparator;
13

  
14
/**
15
 * @author k.luther
16
 * @date 08.06.2016
17
 *
18
 */
19
public class TermIdInVocabularyComparator<T extends DefinedTermBase<?>> implements Comparator<T> {
20

  
21
    /* (non-Javadoc)
22
     * @see java.util.Comparator#compare(java.lang.Object, java.lang.Object)
23
     */
24
    @Override
25
    public int compare(T term1, T term2) {
26
        String label1 = term1.getIdInVocabulary();
27
        String label2 = term2.getIdInVocabulary();
28
        return label1.compareTo(label2);
29
    }
30

  
31

  
32

  
33
}

Also available in: Unified diff