private static abstract class AbstractPathArgument implements PathArgument {
private static final long serialVersionUID = -4546547994250849340L;
private final QName nodeType;
+ private volatile transient Integer hash = null;
protected AbstractPathArgument(final QName nodeType) {
this.nodeType = Preconditions.checkNotNull(nodeType);
return nodeType.compareTo(o.getNodeType());
}
- @Override
- public int hashCode() {
+ protected int hashCodeImpl() {
return 31 + getNodeType().hashCode();
}
+ @Override
+ public final int hashCode() {
+ Integer ret = hash;
+ if (ret == null) {
+ synchronized (this) {
+ ret = hash;
+ if (ret == null) {
+ ret = hashCodeImpl();
+ hash = ret;
+ }
+ }
+ }
+
+ return ret;
+ }
+
@Override
public boolean equals(final Object obj) {
if (this == obj) {
}
@Override
- public int hashCode() {
+ protected int hashCodeImpl() {
final int prime = 31;
- int result = super.hashCode();
+ int result = super.hashCodeImpl();
result = prime * result;
for (Entry<QName, Object> entry : keyValues.entrySet()) {
}
@Override
- public int hashCode() {
+ protected int hashCodeImpl() {
final int prime = 31;
- int result = super.hashCode();
+ int result = super.hashCodeImpl();
result = prime * result + ((value == null) ? 0 : YangInstanceIdentifier.hashCode(value));
return result;
}