Java Hash String hash(final String s1, final String s2, final String[] a)

Here you can find the source of hash(final String s1, final String s2, final String[] a)

Description

hash

License

Apache License

Declaration

public static final int hash(final String s1, final String s2, final String[] a) 

Method Source Code

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

public class Main {
    public static final int hash(final String s1, final String s2, final String[] a) {
        int len = a != null ? a.length : 0;
        int h = 0;
        h = hash(s1, h);//ww w .jav a 2s  .  c om
        h = 31 * h + '\t';
        h = hash(s2, h);
        h = 31 * h + '\t';
        for (int i = 0; i < len; i++) {
            h = hash(a[i], h);
            h = 31 * h + '\t';
        }
        return h;
    }

    public static final int hash(final String[] a) {
        if (a == null || a.length < 1) {
            return 0;
        }
        int len = a.length;
        int h = 0;
        for (int i = 0; i < len; i++) {
            h = hash(a[i], h);
            h = 31 * h + '\t';
        }
        return h;
    }

    public static final int hash(final String a, int h) {
        if (a == null || a.length() == 0) {
            return h;
        }
        int len = a.length();

        for (int i = 0; i < len; i++) {
            h = 31 * h + a.charAt(i);
        }
        return h;
    }
}

Related

  1. hash(String arg)
  2. hash(String data)
  3. hash(String data)
  4. hash(String name)