Index: /luni/src/main/java/java/lang/Boolean.java
===================================================================
--- /luni/src/main/java/java/lang/Boolean.java (revision 383745)
+++ /luni/src/main/java/java/lang/Boolean.java (working copy)
@@ -15,11 +15,12 @@
package java.lang;
-
/**
- * Booleans are objects (i.e. non-base types) which represent boolean values.
+ *
Boolean is the wrapper for the primitive type boolean.
+ * @since 1.0
*/
public final class Boolean implements java.io.Serializable {
+ //TODO Add Comparable to implements when generics are supported.
private static final long serialVersionUID = -3665804199014368530L;
@@ -136,8 +137,23 @@
* @return the boolean value.
*/
static boolean toBoolean(String string) {
- return (string != null) && (string.toLowerCase().equals("true"));
+ return parseBoolean(string);
}
+
+ /**
+ *
+ * Parses the string as a boolean. If the string is not
+ * null and is equal to "true", regardless
+ * case, then true is returned, otherwise false.
+ *
+ *
+ * @param s The string to parse.
+ * @return A boolean value.
+ * @since 1.5
+ */
+ public static boolean parseBoolean(String s) {
+ return "true".equalsIgnoreCase(s);
+ }
/**
* Answers a string containing a concise, human-readable description of the