Java Hash String hashString(String str)

Here you can find the source of hashString(String str)

Description

hash String

License

Open Source License

Declaration

public static int hashString(String str) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

public class Main {
    public static int hashString(String str) {
        // See http://stackoverflow.com/questions/2624192/good-hash-function-for-strings
        int hash = 7;
        for (int i = 0; i < str.length(); i++) {
            hash = hash * 31 + str.charAt(i);
        }/* w w  w  . j a  v a  2  s.c o  m*/
        return hash;
    }
}

Related

  1. hashString(CharSequence str)
  2. hashString(String data, int seed)
  3. hashString(String s)
  4. hashString(String s)
  5. hashString(String s)
  6. hashString(String str)
  7. hashTermToString(int i, int h)
  8. hasHtmlTag(String content)
  9. hasHTMLTag(String html)