home *** CD-ROM | disk | FTP | other *** search
Java Source | 1996-09-10 | 655 b | 25 lines |
- // Copyright(c) 1996 ObjectSpace, Inc.
- // Portions Copyright(c) 1995, 1996 Hewlett-Packard Company.
-
- package jgl;
-
- /**
- * Hash is a unary function that returns the hash code of its operand.
- * <p>
- * @version 1.1
- * @author ObjectSpace, Inc.
- */
-
- public class Hash implements UnaryFunction
- {
- /**
- * Return the hash code of my operand as an Integer, or 0 if the operand is null.
- * @param object The operand.
- * @return The hash code of the operand, using the standard Java hashCode() method.
- */
- public Object execute( Object object )
- {
- return new Integer( object == null ? 0 : object.hashCode() );
- }
- }
-