Java Array Deep Hash Code deepHashCode(final Iterable stream)

Here you can find the source of deepHashCode(final Iterable stream)

Description

deep Hash Code

License

Apache License

Declaration

public static <T> int deepHashCode(final Iterable<T> stream) 

Method Source Code

//package com.java2s;
/*//from w  w  w .  j  ava 2 s  .  c  o  m
   Copyright 2009 Tomer Gabel <tomer@tomergabel.com>
    
   Licensed under the Apache License, Version 2.0 (the "License");
   you may not use this file except in compliance with the License.
   You may obtain a copy of the License at
    
  http://www.apache.org/licenses/LICENSE-2.0
    
   Unless required by applicable law or agreed to in writing, software
   distributed under the License is distributed on an "AS IS" BASIS,
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   See the License for the specific language governing permissions and
   limitations under the License.
    
    
   ant-intellij-tasks project (http://code.google.com/p/ant-intellij-tasks/)
    
   $Id$
*/

public class Main {
    public static <T> int deepHashCode(final Iterable<T> stream) {
        int hash = 0;
        for (final T next : stream)
            hash = 31 * hash + (next == null ? 0 : next.hashCode());
        return hash;
    }
}

Related

  1. deepHashCode(byte[] array)
  2. deepHashCode(Object a[])
  3. deepHashCode(Object a[])