112 public Boolean(String s) {
113 this(parseBoolean(s));
114 }
115
116 /**
117 * Parses the string argument as a boolean. The {@code boolean}
118 * returned represents the value {@code true} if the string argument
119 * is not {@code null} and is equal, ignoring case, to the string
120 * {@code "true"}.
121 * Otherwise, a false value is returned, including for a null
122 * argument.<p>
123 * Example: {@code Boolean.parseBoolean("True")} returns {@code true}.<br>
124 * Example: {@code Boolean.parseBoolean("yes")} returns {@code false}.
125 *
126 * @param s the {@code String} containing the boolean
127 * representation to be parsed
128 * @return the boolean represented by the string argument
129 * @since 1.5
130 */
131 public static boolean parseBoolean(String s) {
132 return ((s != null) && s.equalsIgnoreCase("true"));
133 }
134
135 /**
136 * Returns the value of this {@code Boolean} object as a boolean
137 * primitive.
138 *
139 * @return the primitive {@code boolean} value of this object.
140 */
141 @HotSpotIntrinsicCandidate
142 public boolean booleanValue() {
143 return value;
144 }
145
146 /**
147 * Returns a {@code Boolean} instance representing the specified
148 * {@code boolean} value. If the specified {@code boolean} value
149 * is {@code true}, this method returns {@code Boolean.TRUE};
150 * if it is {@code false}, this method returns {@code Boolean.FALSE}.
151 * If a new {@code Boolean} instance is not required, this method
152 * should generally be used in preference to the constructor
|
112 public Boolean(String s) {
113 this(parseBoolean(s));
114 }
115
116 /**
117 * Parses the string argument as a boolean. The {@code boolean}
118 * returned represents the value {@code true} if the string argument
119 * is not {@code null} and is equal, ignoring case, to the string
120 * {@code "true"}.
121 * Otherwise, a false value is returned, including for a null
122 * argument.<p>
123 * Example: {@code Boolean.parseBoolean("True")} returns {@code true}.<br>
124 * Example: {@code Boolean.parseBoolean("yes")} returns {@code false}.
125 *
126 * @param s the {@code String} containing the boolean
127 * representation to be parsed
128 * @return the boolean represented by the string argument
129 * @since 1.5
130 */
131 public static boolean parseBoolean(String s) {
132 return "true".equalsIgnoreCase(s);
133 }
134
135 /**
136 * Returns the value of this {@code Boolean} object as a boolean
137 * primitive.
138 *
139 * @return the primitive {@code boolean} value of this object.
140 */
141 @HotSpotIntrinsicCandidate
142 public boolean booleanValue() {
143 return value;
144 }
145
146 /**
147 * Returns a {@code Boolean} instance representing the specified
148 * {@code boolean} value. If the specified {@code boolean} value
149 * is {@code true}, this method returns {@code Boolean.TRUE};
150 * if it is {@code false}, this method returns {@code Boolean.FALSE}.
151 * If a new {@code Boolean} instance is not required, this method
152 * should generally be used in preference to the constructor
|