Here you can find the source of hash(String data)
public static int hash(String data)
//package com.java2s; //License from project: Open Source License public class Main { /**/*from w ww. j a v a 2s .c o m*/ * {@native ts * var hash = 0, i, chr, len; * if (data.length === 0) return hash; * for (i = 0, len = data.length; i < len; i++) { * chr = data.charCodeAt(i); * hash = ((hash << 5) - hash) + chr; * hash |= 0; // Convert to 32bit integer * } * return hash; * } */ public static int hash(String data) { /* long h = HSTART; final long hmult = HMULT; final long[] ht = byteTable; int dataLength = data.length(); for (int i = 0; i < dataLength; i++) { h = (h * hmult) ^ ht[data.codePointAt(i) & 0xff]; } return h % Constants.END_OF_TIME; */ return data.hashCode(); } }