alvinalexander.com | career | drupal | java | mac | mysql | perl | scala | uml | unix  

What this is

This file is included in the DevDaily.com "Java Source Code Warehouse" project. The intent of this project is to help you "Learn Java by Example" TM.

Other links

The source code

package org.netbeans.modules.tasklist.usertasks.treetable;

import java.util.Comparator;

/**
 * Compares Boolean values
 */
public class BooleanComparator implements Comparator {
    public int compare(java.lang.Object o1, java.lang.Object o2) {
        if (o1 == null && o2 == null)
            return 0;
        if (o1 == null)
            return -1;
        if (o2 == null)
            return 1;
        boolean b1 = ((Boolean) o1).booleanValue();
        boolean b2 = ((Boolean) o2).booleanValue();
        if (b1 == b2)
            return 0;
        if (b1)
            return 1;
        else
            return -1;
    }
}
... this post is sponsored by my books ...

#1 New Release!

FP Best Seller

 

new blog posts

 

Copyright 1998-2021 Alvin Alexander, alvinalexander.com
All Rights Reserved.

A percentage of advertising revenue from
pages under the /java/jwarehouse URI on this website is
paid back to open source projects.