/*
- * Copyright 2000-2009 JetBrains s.r.o.
+ * Copyright 2000-2010 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
*/
package com.intellij.openapi.util;
-import java.util.Arrays;
-
+import org.apache.commons.lang.builder.HashCodeBuilder;
/**
*
public class Pair<A, B> {
public final A first;
public final B second;
+ private final int hashcode;
public Pair(A first, B second) {
this.first = first;
this.second = second;
+ hashcode = new HashCodeBuilder().append(first).append(second).toHashCode();
}
public final A getFirst() {
return o instanceof Pair && Comparing.equal(first, ((Pair)o).first) && Comparing.equal(second, ((Pair)o).second);
}
- public final int hashCode(){
- int hashCode = 0;
- if (first != null){
- hashCode += hashCode(first);
- }
- if (second != null){
- hashCode += hashCode(second);
- }
- return hashCode;
- }
-
- private static int hashCode(final Object o) {
- return (o instanceof Object[]) ? Arrays.hashCode((Object[])o) : o.hashCode();
+ public final int hashCode() {
+ return hashcode;
}
public String toString() {
<orderEntry type="module" module-name="platform-resources-en" />
<orderEntry type="library" name="OroMatcher" level="project" />
<orderEntry type="module" module-name="annotations" exported="" />
+ <orderEntry type="library" name="commons-lang" level="project" />
</component>
<component name="copyright">
<Base>