List of usage examples for java.lang Object hashCode
@HotSpotIntrinsicCandidate public native int hashCode();
From source file:SoftSet.java
public boolean remove(Object o) { processQueue();//w ww.jav a 2s .c o m Integer key = new Integer(o.hashCode()); return map.remove(key) != null; }
From source file:SoftSet.java
public boolean contains(Object o) { processQueue();//from w w w . jav a 2s. c o m Integer key = new Integer(o.hashCode()); boolean contains = map.containsKey(key); return contains; }
From source file:SoftSet.java
public boolean add(Object o) { processQueue();/* w w w . j a v a2s . c o m*/ Integer key = new Integer(o.hashCode()); ComparableSoftReference sr = new ComparableSoftReference(key, o, gcqueue); return map.put(key, sr) == null; }
From source file:com.sp.keyword_generator.Keyword.java
@Override public boolean equals(Object obj) { if (obj == null) { return false; }/*from www .j a va 2 s . c o m*/ if (getClass() != obj.getClass()) { return false; } if (obj.hashCode() == hashCode()) { return true; } return false; }
From source file:SoftSet.java
public boolean containsAll(Collection c) { processQueue();/*from w w w . ja va 2s . c o m*/ Iterator iter = c.iterator(); boolean contains = true; while (iter.hasNext()) { Object value = iter.next(); Integer key = new Integer(value.hashCode()); contains &= map.containsKey(key); } return contains; }
From source file:com.tesora.dve.sql.schema.TColumnDatum.java
@Override public int hashCode() { Object valueToHash = getValue(); if (valueToHash != null && valueToHash.getClass().isArray()) { return ArrayUtils.hashCode(valueToHash); }/*www. java2s.com*/ return (valueToHash == null ? 0 : valueToHash.hashCode()); }
From source file:SoftSet.java
public boolean addAll(Collection c) { processQueue();/* w w w .j a v a 2 s . com*/ Iterator iter = c.iterator(); boolean added = false; while (iter.hasNext()) { Object value = iter.next(); Integer key = new Integer(value.hashCode()); ComparableSoftReference sr = new ComparableSoftReference(key, value, gcqueue); added |= map.put(key, sr) == null; } return added; }
From source file:eu.scidipes.toolkits.palibrary.impl.UploadManifest.java
@Override public final boolean equals(final Object obj) { return obj == this || (obj instanceof Manifest && obj.hashCode() == this.hashCode()); }
From source file:ai.susi.server.api.aaa.AccessServlet.java
@Override protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { Query post = RemoteAccess.evaluate(request); if (post.isDoS_servicereduction() || post.isDoS_blackout()) { response.sendError(503, "your request frequency is too high"); return;//from ww w.j av a 2 s . com } // DoS protection boolean anonymize = !post.isLocalhostAccess(); String callback = post.get("callback", ""); boolean jsonp = callback != null && callback.length() > 0; post.setResponse(response, "application/javascript"); Collection<Track> tracks = DAO.access.getTracks(); // generate json JSONObject json = new JSONObject(true); JSONArray access = new JSONArray(); json.put("access", access); int maxcount = anonymize ? 100 : 1000; for (Track track : tracks) { if (anonymize && !track.get("class").equals("SearchServlet")) continue; JSONObject a = new JSONObject(true); for (String key : track.keySet()) { Object value = track.get(key); if (anonymize && "host".equals(key)) { a.put("host-anonymized", Integer.toHexString(Math.abs(value.hashCode()))); } else { a.put(key, value); } } access.put(a); if (maxcount-- <= 0) break; } // write json PrintWriter sos = response.getWriter(); if (jsonp) sos.print(callback + "("); sos.print(json.toString(2)); if (jsonp) sos.println(");"); sos.println(); post.finalize(); }
From source file:edu.stanford.junction.addon.JSONObjWrapper.java
public boolean equals(Object other) { return other.hashCode() == this.hashCode(); }