/****************************************************************************** String Less Than Comparator ---------------------------------------------------- Copyright (c) Gunnar Gotshalks. All Rights Reserved. Permission to use, copy, modify, and distribute this software and its documentation for NON-COMMERCIAL purposes and without fee is hereby granted. *******************************************************************************/ package FlexOr.container; /** Compare two strings.
@author Gunnar Gotshalks @see java.util.Vector @version 1.0 1999 Jan 15 */ public class StringLessThan implements BinaryPredicate { /** Return true if string a < string b, else return false. @exception if at least one of a or b is not a String. */ public final boolean execute(final Object a, final Object b) { if (! ((a instanceof String) && (b instanceof String))) { throw new BinPredParamException(); } return ((String) a).compareTo((String) b) < 0; } public static boolean execute(final String a, final String b) { BinaryPredicate comp = new StringLessThan(); return comp.execute(a, b); } }