/* * [StringComparatorIgnoreCase.java] * * Summary: Sort alphabetically, case-insensitive. * * Copyright: (c) 2009-2017 Roedy Green, Canadian Mind Products, http://mindprod.com * * Licence: This software may be copied and used freely for any purpose but military. * http://mindprod.com/contact/nonmil.html * * Requires: JDK 1.8+ * * Created with: JetBrains IntelliJ IDEA IDE http://www.jetbrains.com/idea/ * * Version History: * 1.4 2007-05-22 add icon and PAD. */ package com.mindprod.comparators; import java.util.Comparator; /** * Sort alphabetically, case-insensitive. *

* Defines an alternate sort order for String. * * @author Roedy Green, Canadian Mind Products * @version 1.1 2009-04-13 add comments * @since 2002-05-21 */ public class StringComparatorIgnoreCase implements Comparator { /** * Sort alphabetically, case-insensitive. *

* Defines an alternate sort order for String. * Compare two String Objects. * Informally, returns (a-b), or +ve if a is more positive than b. *

* * @param a first String to compare * @param b second String to compare *

* * @return +ve if a>b, 0 if a==b, -ve if a<b * @author Roedy Green, Canadian Mind Products * @version 1.4 2007-05-22 add icon and PAD. * @since 2009 */ public final int compare( String a, String b ) { return a.compareToIgnoreCase( b ); } }