List of usage examples for java.lang Object hashCode
@HotSpotIntrinsicCandidate public native int hashCode();
From source file:org.springframework.nanotrader.account.AccountProfile.java
public boolean equals(Object o) { if (o == null) { return false; }//from w w w . j a v a 2 s .co m if (!(o instanceof AccountProfile)) { return false; } return o.hashCode() == hashCode(); }
From source file:ObjectUtils.java
/** * Return as hash code for the given object; typically the value of * <code>{@link Object#hashCode()}</code>. If the object is an array, * this method will delegate to any of the <code>nullSafeHashCode</code> * methods for arrays in this class. If the object is <code>null</code>, * this method returns 0.//from ww w . j av a2s . co m * @see #nullSafeHashCode(Object[]) * @see #nullSafeHashCode(boolean[]) * @see #nullSafeHashCode(byte[]) * @see #nullSafeHashCode(char[]) * @see #nullSafeHashCode(double[]) * @see #nullSafeHashCode(float[]) * @see #nullSafeHashCode(int[]) * @see #nullSafeHashCode(long[]) * @see #nullSafeHashCode(short[]) */ public static int nullSafeHashCode(Object obj) { if (obj == null) { return 0; } if (obj instanceof Object[]) { return nullSafeHashCode((Object[]) obj); } if (obj instanceof boolean[]) { return nullSafeHashCode((boolean[]) obj); } if (obj instanceof byte[]) { return nullSafeHashCode((byte[]) obj); } if (obj instanceof char[]) { return nullSafeHashCode((char[]) obj); } if (obj instanceof double[]) { return nullSafeHashCode((double[]) obj); } if (obj instanceof float[]) { return nullSafeHashCode((float[]) obj); } if (obj instanceof int[]) { return nullSafeHashCode((int[]) obj); } if (obj instanceof long[]) { return nullSafeHashCode((long[]) obj); } if (obj instanceof short[]) { return nullSafeHashCode((short[]) obj); } return obj.hashCode(); }
From source file:com.edmunds.etm.management.api.ManagementVips.java
@Override public boolean equals(Object o) { if (this == o) { return true; }/*from w w w. ja v a2s . c o m*/ // Optimize using the hashCode. if (o == null || getClass() != o.getClass() || hashCode != o.hashCode()) { return false; } ManagementVips other = (ManagementVips) o; return new EqualsBuilder().append(vipsByMavenModule, other.vipsByMavenModule).isEquals(); }
From source file:IntMap.java
/** * Puts a new value in the property table with the appropriate flags *///from ww w .jav a 2 s.co m public int put(Object key, int value) { int mask = _mask; int hash = key.hashCode() % mask & mask; Object[] keys = _keys; while (true) { Object testKey = keys[hash]; if (testKey == null || testKey == DELETED) { keys[hash] = key; _values[hash] = value; _size++; if (keys.length <= 4 * _size) resize(4 * keys.length); return NULL; } else if (key != testKey && !key.equals(testKey)) { hash = (hash + 1) % mask; continue; } else { int old = _values[hash]; _values[hash] = value; return old; } } }
From source file:org.malaguna.cmdit.service.reflection.ReflectionUtils.java
@Override public boolean evaluate(Object obj) { return obj.hashCode() == hash; }
From source file:org.projectforge.model.rest.TaskObject.java
/** * @see Object#equals(Object)/* ww w .j a va 2s.co m*/ */ @Override public boolean equals(final Object obj) { if (obj instanceof TaskObject == false) { return false; } return this.hashCode() == obj.hashCode(); }
From source file:org.rifidi.designer.entities.grouping.EntityGroup.java
@Override public boolean equals(final Object obj) { if (obj instanceof EntityGroup) { return obj.hashCode() == hashCode(); }/*from w w w .ja va2 s .co m*/ return false; }
From source file:de.dal33t.powerfolder.util.collection.CompositeSet.java
/** * @see Set#hashCode//from w w w. ja va 2 s .c o m */ public int hashCode() { int code = 0; for (Iterator i = this.iterator(); i.hasNext();) { Object next = i.next(); code += (next != null ? next.hashCode() : 0); } return code; }
From source file:net.sourceforge.cobertura.metrics.model.coverage.Rate.java
/** * {@inheritDoc}//w w w. j a v a 2 s .co m */ @Override public boolean equals(Object obj) { // Check sanity if (obj == null) { return false; } // All done. return (obj instanceof Rate) && (hashCode() == obj.hashCode()); }
From source file:com.servioticy.queueclient.KestrelThriftClient.java
@Override protected boolean putImpl(Object item) { int numKestrels = _kestrels.size(); int kestrelIndex = Math.abs(item.hashCode()) % numKestrels; KestrelClientInfo info;// w ww. ja va 2 s . c om long now = System.currentTimeMillis(); for (int i = 0; i < numKestrels; i++) { info = _kestrels.get((kestrelIndex + i) % numKestrels); if (now > info.blacklistTillTimeMs) { List<ByteBuffer> items = new ArrayList<ByteBuffer>(); items.add(ByteBuffer.wrap(serialize(item))); try { if (item instanceof String) { info.getValidClient().put(getRelativeAddress(), (String) item, 0); return true; } else if (info.getValidClient().put(getRelativeAddress(), items, 0) == 1) { return true; } } catch (TException e) { blacklist(info, e); continue; } } } return false; }