KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > modules > tasklist > usertasks > treetable > BooleanComparator


1 package org.netbeans.modules.tasklist.usertasks.treetable;
2
3 import java.util.Comparator JavaDoc;
4
5 /**
6  * Compares Boolean values
7  */

8 public class BooleanComparator implements Comparator JavaDoc {
9     public int compare(java.lang.Object JavaDoc o1, java.lang.Object JavaDoc o2) {
10         if (o1 == null && o2 == null)
11             return 0;
12         if (o1 == null)
13             return -1;
14         if (o2 == null)
15             return 1;
16         boolean b1 = ((Boolean JavaDoc) o1).booleanValue();
17         boolean b2 = ((Boolean JavaDoc) o2).booleanValue();
18         if (b1 == b2)
19             return 0;
20         if (b1)
21             return 1;
22         else
23             return -1;
24     }
25 }
26
Popular Tags