Created
February 7, 2019 20:04
-
-
Save jerolba/fe159b3f945f13dd285a80876743e08e to your computer and use it in GitHub Desktop.
Arrays hashCode method
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static int hashCode(Object a[]) { | |
if (a == null) return 0; | |
int result = 1; | |
for (Object element : a) | |
result = 31 * result + (element == null ? 0 : element.hashCode()); | |
return result; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment