I have Longand a String. I want to create a hash of both of these objects. Meaning, I want some function to execute an arbitrary number of objects and return to me a single value of the hash function. Does such a function come out?
Long
String
Something like that:
public int getHash(Object... objects) { //somehow returns a hash of all these objects }
Take a look at Arrays.hashCode(Object[]).
Arrays.hashCode(Object[])
It does not accept varargs, but you can wrap it with your own varargs library function if you want:
public static int computeHashCode(Object... objects) { return Arrays.hashCode(objects); }
Apache Commons HashCodeBuilder contains a reflection-based call that looks like what you want.
public int hashCode() { return HashCodeBuilder.reflectionHashCode(this); }
Source: https://habr.com/ru/post/1795846/More articles:smooth horizontal scrolling in webview - androidThe https connection works via Wi-Fi (wlan), but not for 3G / GPRS (umts) - androidWindows batch variables - windowsSandbox loading AppDomain disables debugger - debugging.net Dictionary.Resize() исключение - безопасность потоков? - dictionaryWITH#; Redirecting a standard error of a process, but not its standard output - redirectWhy doesn't the style change even when I change site.css? - cssWhat is a quick way to search through xml - c #Best way to find data in xml files? - c #deserialize javascript date on asp.net mvc 3 server - javascriptAll Articles