List of usage examples for java.lang Object hashCode
@HotSpotIntrinsicCandidate public native int hashCode();
From source file:com.liferay.util.portlet.PortletRequestUtil.java
private static boolean _isValidAttributeValue(Object obj) { if (obj == null) { return false; } else if (obj instanceof Collection<?>) { Collection<?> col = (Collection<?>) obj; if (col.size() == 0) { return false; } else {// w w w . ja v a 2 s . c om return true; } } else if (obj instanceof Map<?, ?>) { Map<?, ?> map = (Map<?, ?>) obj; if (map.size() == 0) { return false; } else { return true; } } else { String objString = String.valueOf(obj); if (Validator.isNull(objString)) { return false; } String hashCode = StringPool.AT.concat(StringUtil.toHexString(obj.hashCode())); if (objString.endsWith(hashCode)) { return false; } return true; } }
From source file:com.qrmedia.commons.collections.Pair.java
private int hashCode(Object object) { return ((object != null) ? object.hashCode() : 0); }
From source file:com.thinkbiganalytics.jpa.TruncateStringUserType.java
@Override public int hashCode(Object o) throws HibernateException { assert (o != null); return o.hashCode(); }
From source file:edu.vt.middleware.ldap.bean.AbstractLdapBean.java
/** * Returns whether the supplied <code>Object</code> contains the same data as * this bean./* w ww . j av a 2s . c o m*/ * * @param o <code>Object</code> * * @return <code>boolean</code> */ public boolean equals(final Object o) { if (o == null) { return false; } return o == this || (this.getClass() == o.getClass() && o.hashCode() == this.hashCode()); }
From source file:HashCode.java
/** * Compute a combined hash code from the supplied objects using the supplied seed. * @param seed a value upon which the hash code will be based; may be 0 * @param objects the objects that should be used to compute the hash code * @return the hash code/*from ww w. j ava 2 s . c o m*/ */ protected static int compute(int seed, Object... objects) { if (objects == null || objects.length == 0) { return seed * HashCode.PRIME; } // Compute the hash code for all of the objects ... int hc = seed; for (Object object : objects) { hc = HashCode.PRIME * hc; if (object instanceof byte[]) { hc += Arrays.hashCode((byte[]) object); } else if (object instanceof boolean[]) { hc += Arrays.hashCode((boolean[]) object); } else if (object instanceof short[]) { hc += Arrays.hashCode((short[]) object); } else if (object instanceof int[]) { hc += Arrays.hashCode((int[]) object); } else if (object instanceof long[]) { hc += Arrays.hashCode((long[]) object); } else if (object instanceof float[]) { hc += Arrays.hashCode((float[]) object); } else if (object instanceof double[]) { hc += Arrays.hashCode((double[]) object); } else if (object instanceof char[]) { hc += Arrays.hashCode((char[]) object); } else if (object instanceof Object[]) { hc += Arrays.hashCode((Object[]) object); } else if (object != null) { hc += object.hashCode(); } } return hc; }
From source file:ar.com.zauber.commons.repository.utils.URIUserType.java
/** * @see usertype.UserType#hashCode(Object) * @throws HibernateException//from w w w . j a v a2s. c o m * on error */ public final int hashCode(final Object x) throws HibernateException { return x.hashCode(); }
From source file:org.apache.shindig.social.opensocial.spi.CollectionOptions.java
private int getHashCode(Object o) { return o == null ? 0 : o.hashCode(); }
From source file:org.projectbuendia.client.utils.Colorizer.java
/** Gets an ARGB value for the specified object. */ public int getColorArgb(Object o) { return getColorArgb(mix(o == null ? 0 : o.hashCode())); }
From source file:com.l2jfree.sql.L2DBEntity.java
@Override public int hashCode() { final Object pk = getPrimaryKey(); if (pk == null) return 0; return L2System.hash(pk.hashCode()); }
From source file:org.springframework.nanotrader.order.Order.java
public boolean equals(Object o) { return o != null && o instanceof Order && o.hashCode() == hashCode(); }