Custom hashCode() implementation semantically identical to Object.hashCode(). This one is much faster since Object.hashCode() is native JNI call.

This commit is contained in:
Maxim Shafirov
2009-11-16 19:25:02 +03:00
parent 6c06dfe43c
commit 57797f6db5
@@ -23,6 +23,10 @@ public abstract class OrderEntryBaseImpl extends RootModelComponentBase implemen
private static final Logger LOG = Logger.getInstance("#com.intellij.openapi.roots.impl.OrderEntryVeryBaseImpl");
private int myIndex;
private static int _hc = 0;
@SuppressWarnings({"AssignmentToStaticFieldFromInstanceMethod"})
private final int hc = _hc++;
protected OrderEntryBaseImpl(RootModelImpl rootModel) {
super(rootModel);
@@ -40,4 +44,15 @@ public abstract class OrderEntryBaseImpl extends RootModelComponentBase implemen
boolean sameType(OrderEntry that) {
return getClass().equals(that.getClass());
}
@Override
@SuppressWarnings({"EqualsWhichDoesntCheckParameterClass"})
public boolean equals(Object obj) {
return obj == this;
}
@Override
public int hashCode() {
return hc;
}
}