Here you can find the source of hashCode(final long l)
Parameter | Description |
---|---|
l | The long number for which to calculate the hashcode. |
public static int hashCode(final long l)
//package com.java2s; /* ******************************************************************** * NightLabs PDF Viewer - http://www.nightlabs.org/projects/pdfviewer * * Copyright (C) 2004-2008 NightLabs GmbH - http://NightLabs.org * * * * This library is free software; you can redistribute it and/or * * modify it under the terms of the GNU Lesser General Public * * License as published by the Free Software Foundation; either * * version 2.1 of the License, or (at your option) any later version. * * * * This library is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * * Lesser General Public License for more details. * * * * You should have received a copy of the GNU Lesser General Public * * License along with this library; if not, write to the * * Free Software Foundation, Inc., * * 51 Franklin St, Fifth Floor, * * Boston, MA 02110-1301 USA * * * * Or get it online: * * http://www.gnu.org/copyleft/lesser.html * **********************************************************************/ public class Main { /**// w ww. j a va 2 s . co m * @param l The long number for which to calculate the hashcode. * @return the same as new Long(l).hashCode() would do, but * without the overhead of creating a Long instance. */ public static int hashCode(final long l) { return (int) (l ^ (l >>> 32)); } /** * Get a hash code for an object. This method also handles * <code>null</code>-Objects. * @param obj An object or <code>null</code> * @return <code>0</code> if <code>obj == null</code> - * <code>obj.hashCode()</code> otherwise */ public static int hashCode(final Object obj) { return obj == null ? 0 : obj.hashCode(); } }