diff --git a/classpath/java/util/Arrays.java b/classpath/java/util/Arrays.java index dc607189d9..006d192c22 100644 --- a/classpath/java/util/Arrays.java +++ b/classpath/java/util/Arrays.java @@ -42,6 +42,27 @@ public class Arrays { } } + public static int hashCode(T[] array) { + int hc = 823347; + for(T t : array) { + hc += t.hashCode(); + hc *= 3; + } + return hc; + } + + public static boolean equals(T[] a, T[] b) { + if(a.length != b.length) { + return false; + } + for(int i = 0; i < a.length; i++) { + if(!a[i].equals(b[i])) { + return false; + } + } + return true; + } + public static List asList(final T ... array) { return new List() { public String toString() {