183 * string equal to {@code "false"} is returned.
184 *
185 * @return a string representation of this object.
186 */
187 public String toString() {
188 return value ? "true" : "false";
189 }
190
191 /**
192 * Returns a hash code for this {@code Boolean} object.
193 *
194 * @return the integer {@code 1231} if this object represents
195 * {@code true}; returns the integer {@code 1237} if this
196 * object represents {@code false}.
197 */
198 public int hashCode() {
199 return value ? 1231 : 1237;
200 }
201
202 /**
203 * Returns {@code true} if and only if the argument is not
204 * {@code null} and is a {@code Boolean} object that
205 * represents the same {@code boolean} value as this object.
206 *
207 * @param obj the object to compare with.
208 * @return {@code true} if the Boolean objects represent the
209 * same value; {@code false} otherwise.
210 */
211 public boolean equals(Object obj) {
212 if (obj instanceof Boolean) {
213 return value == ((Boolean)obj).booleanValue();
214 }
215 return false;
216 }
217
218 /**
219 * Returns {@code true} if and only if the system property
220 * named by the argument exists and is equal to the string
221 * {@code "true"}. (Beginning with version 1.0.2 of the
222 * Java<small><sup>TM</sup></small> platform, the test of
|
183 * string equal to {@code "false"} is returned.
184 *
185 * @return a string representation of this object.
186 */
187 public String toString() {
188 return value ? "true" : "false";
189 }
190
191 /**
192 * Returns a hash code for this {@code Boolean} object.
193 *
194 * @return the integer {@code 1231} if this object represents
195 * {@code true}; returns the integer {@code 1237} if this
196 * object represents {@code false}.
197 */
198 public int hashCode() {
199 return value ? 1231 : 1237;
200 }
201
202 /**
203 * Returns a hash code for a {@code boolean} value; compatible with
204 * {@code Boolean.hashCode()}.
205 *
206 * @since 1.8
207 *
208 * @return a hash code value for a {@code boolean} value.
209 */
210 public static int hashCode(boolean value) {
211 return value ? 1231 : 1237;
212 }
213
214 /**
215 * Returns {@code true} if and only if the argument is not
216 * {@code null} and is a {@code Boolean} object that
217 * represents the same {@code boolean} value as this object.
218 *
219 * @param obj the object to compare with.
220 * @return {@code true} if the Boolean objects represent the
221 * same value; {@code false} otherwise.
222 */
223 public boolean equals(Object obj) {
224 if (obj instanceof Boolean) {
225 return value == ((Boolean)obj).booleanValue();
226 }
227 return false;
228 }
229
230 /**
231 * Returns {@code true} if and only if the system property
232 * named by the argument exists and is equal to the string
233 * {@code "true"}. (Beginning with version 1.0.2 of the
234 * Java<small><sup>TM</sup></small> platform, the test of
|