Java equals
boolean java.lang.Object.equals(Object obj)
Indicates whether some other
object is "equal to" this one.
The equals method implements an
equivalence relation on non-null object references:
It is reflexive: for
any non-null reference value x, x.equals(x) should return true.
It is
symmetric: for any non-null reference values x and y, x.equals(y) should return
true if and only if y.equals(x) returns true.
It is transitive: for any
non-null reference values x, y, and z, if x.equals(y) returns true and
y.equals(z) returns true, then x.equals(z) should return true.
It is
consistent: for any non-null reference values x and y, multiple invocations of
x.equals(y) consistently return true or consistently return false, provided no
information used in equals comparisons on the objects is modified.
For any
non-null reference value x, x.equals(null) should return false.
The equals
method for class Object implements the most discriminating possible equivalence
relation on objects; that is, for any non-null reference values x and y, this
method returns true if and only if x and y refer to the same object (x == y has
the value true).
Note that it is generally
necessary to override the hashCode method whenever this method is overridden, so
as to maintain the general contract for the hashCode method, which states that
equal objects must have equal hash codes
.
See
Also:
hashCode()
java.util.Hashtable
Parameters:
obj the
reference object with which to compare.
Returns:
true if this object is
the same as the obj argument; false otherwise.
相关文档:
Java 理论与实践: 描绘线程安全性
2007-12-15 00:10
——线程安全不是一个非真即假的命题
Brian Goetz (brian@quiotix.com), 首席顾问, Quiotix Corp
2003 年 11 月 15 日
7月份我们的并发专家 Brian Goetz 将 Hashtable 和 Vector 类描述为“有条件线程安全的”。一个类难道不是线程安全就是线程 ......
用Robot写Java代理
Rational Robot是通过录制用户操作进行功能,性能和兼容性测试的自动化测试工具。通过回放录制脚本进行功能和可靠性测试。本文主要介绍Rational Robot针对java程序和applets如何进行功能测试。
Rational Robot当前版本支持用以下类库开发的Java程序和applet程序:
lJava Foundation Classes(JFCs)
l ......
这个框架也是为google app engine准备的。当时感觉直接在gae上sevlet太烦人了,就封装个简易的框架。使用的时候只需要配置web.xml中DispacherSevlet和package.properties中的package.path(默认扫描的包)即可
gae例子:http://orzblogs.appspot.com/Home.htm
大学的时候很BS java,学了之后就扔掉了,现在工作了才开始 ......
在使用队列中,我们一般都会使用循环队列以保证性能
package com.yz.myqueue;
public class Queue {
private Integer size;
private Integer front;
private Integer rear;
private Object[] datas;
public Queue(int size){
this.size=size;
this.front=-1;
this.rear=-1;
datas=new Object[size] ......