Java Hash Code Calculate hashCode(CharSequence seq)

Here you can find the source of hashCode(CharSequence seq)

Description

hash Code

License

Apache License

Declaration

public static int hashCode(CharSequence seq) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

public class Main {
    public static int hashCode(CharSequence seq) {

        final int prime = 31;
        int result = 1;

        for (int i = 0, len = seq.length(); i < len; i++) {
            result = prime * result + seq.charAt(i);
        }/*  w w w.j  ava2 s  .c o m*/

        return result;
    }
}

Related

  1. hashCode(byte[] bytes, int size)
  2. hashCode(byte[] data, int offset, int len, int seed)
  3. hashCode(char[] array)
  4. hashCode(char[] array, int start, int end)
  5. hashCode(char[] array, int start, int end)
  6. hashCode(double dbl)
  7. hashCode(double v)
  8. hashCode(double val)
  9. hashCode(final byte[] data)