Here you can find the source of hashCode(final int i)
Parameter | Description |
---|---|
i | The integer for which a hash code should be computed. |
i
.
public static final int hashCode(final int i)
//package com.java2s; /******************************************************************************* * Copyright (c) 2000, 2006 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors:/*from w w w .j ava 2s . c om*/ * IBM Corporation - initial API and implementation *******************************************************************************/ public class Main { /** * Computes the hash code for an integer. * * @param i * The integer for which a hash code should be computed. * @return <code>i</code>. */ public static final int hashCode(final int i) { return i; } /** * Computes the hash code for an object, but with defense against * <code>null</code>. * * @param object * The object for which a hash code is needed; may be * <code>null</code>. * @return The hash code for <code>object</code>; or <code>0</code> if * <code>object</code> is <code>null</code>. */ public static final int hashCode(final Object object) { return object != null ? object.hashCode() : 0; } }