PageRenderTime 51ms CodeModel.GetById 30ms app.highlight 2ms RepoModel.GetById 18ms app.codeStats 0ms

/src/main/java/com/google/ie/common/comparator/TagTitleComparator.java

http://thoughtsite.googlecode.com/
Java | 48 lines | 12 code | 8 blank | 28 comment | 0 complexity | 8f8a9d464becef40d6e83181f2b91220 MD5 | raw file
 1/* Copyright 2010 Google Inc.
 2 * 
 3 * Licensed under the Apache License, Version 2.0 (the "License");
 4 * you may not use this file except in compliance with the License.
 5 * You may obtain a copy of the License at
 6 * 
 7 *      http://www.apache.org/licenses/LICENSE-2.0
 8 * 
 9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS.
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License
14 */
15
16package com.google.ie.common.comparator;
17
18import com.google.ie.business.domain.Tag;
19
20import java.util.Comparator;
21
22/**
23 * An object that compares {@link Tag} objects with respect to their titles
24 * 
25 * @author Sachneet
26 * 
27 */
28public final class TagTitleComparator implements Comparator<Tag> {
29    /**
30     * A shared default instance of this comparator.This is the only instance
31     * available for this comparator.
32     */
33    public static final TagTitleComparator TAG_TITLE_COMPARATOR = new TagTitleComparator();
34
35    @Override
36    public int compare(Tag tag1, Tag tag2) {
37        return tag1.getTitle().compareTo(tag2.getTitle());
38    }
39
40    /*
41     * Suppresses default constructor, ensuring no instance is created from
42     * outside the class.
43     */
44    private TagTitleComparator() {
45
46    }
47}
48