/** * Save the state of the <tt>HashMap</tt> instance to a stream (i.e., serialize it). * * @param s * The ObjectOutputStream * @throws IOException * * @serialData The <i>capacity</i> of the HashMap (the length of the bucket array) is emitted * (int), followed by the <i>size</i> of the HashMap (the number of key-value * mappings), followed by the key (Object) and value (Object) for each key-value * mapping represented by the HashMap The key-value mappings are emitted in the * order that they are returned by <tt>entrySet().iterator()</tt>. * */ private void writeObject(java.io.ObjectOutputStream s) throws IOException { // Write out the threshold, loadfactor, and any hidden stuff s.defaultWriteObject(); // Write out number of buckets s.writeInt(table.length); // Write out size (number of Mappings) s.writeInt(size); // Write out keys and values (alternating) for (Iterator<Entry<V>> i = entrySet().iterator(); i.hasNext();) { Entry<V> e = i.next(); s.writeInt(e.getKey()); s.writeObject(e.getValue()); } }
/** * Save the state of the <tt>HashMap</tt> instance to a stream (i.e., serialize it). * * @param s * The ObjectOutputStream * @throws IOException * * @serialData The <i>capacity</i> of the HashMap (the length of the bucket array) is emitted * (int), followed by the <i>size</i> of the HashMap (the number of key-value * mappings), followed by the key (Object) and value (Object) for each key-value * mapping represented by the HashMap The key-value mappings are emitted in the * order that they are returned by <tt>entrySet().iterator()</tt>. * */ private void writeObject(java.io.ObjectOutputStream s) throws IOException { // Write out the threshold, loadfactor, and any hidden stuff s.defaultWriteObject(); // Write out number of buckets s.writeInt(table.length); // Write out size (number of Mappings) s.writeInt(size); // Write out keys and values (alternating) for (Iterator i = entrySet().iterator(); i.hasNext();) { Entry e = (Entry)i.next(); s.writeInt(e.getKey()); s.writeObject(e.getValue()); } }
private void writeObject(java.io.ObjectOutputStream s) throws IOException { IntKeyWeakReference ref = null; while ((ref = (IntKeyWeakReference)queue.poll()) != null) { directComponentRefs.remove(ref.uid); } s.defaultWriteObject(); s.writeInt(directComponentRefs.size()); Iterator it = directComponentRefs.entrySet().iterator(); while (it.hasNext()) { IntHashMap.Entry entry = (Entry)it.next(); s.writeInt(entry.getKey()); ComponentAndInterface cai = (ComponentAndInterface)entry.getValue(); s.writeObject(cai.getComponent()); s.writeUTF(cai.getInterfaceName()); } } }
int key = entry.getKey(); int i = indexFor(key, table.length); Entry<V> prev = table[i];
if (cai.getInterfaceName().equals(interfaceName) && cai.getComponent() == component) uid = entry.getKey(); break;
int key = entry.getKey(); int i = indexFor(key, table.length); Entry<V> prev = table[i];
if (cai.getInterfaceName().equals(interfaceName) && cai.getComponent() == component) uid = entry.getKey(); break;
/** * Save the state of the <tt>HashMap</tt> instance to a stream (i.e., serialize it). * * @param s * The ObjectOutputStream * @throws IOException * * @serialData The <i>capacity</i> of the HashMap (the length of the bucket array) is emitted * (int), followed by the <i>size</i> of the HashMap (the number of key-value * mappings), followed by the key (Object) and value (Object) for each key-value * mapping represented by the HashMap The key-value mappings are emitted in the * order that they are returned by <tt>entrySet().iterator()</tt>. * */ private void writeObject(final java.io.ObjectOutputStream s) throws IOException { // Write out the threshold, loadfactor, and any hidden stuff s.defaultWriteObject(); // Write out number of buckets s.writeInt(table.length); // Write out size (number of Mappings) s.writeInt(size); // Write out keys and values (alternating) for (Entry<V> entry : entrySet()) { s.writeInt(entry.getKey()); s.writeObject(entry.getValue()); } }
/** * @see java.lang.Object#equals(java.lang.Object) */ @SuppressWarnings("unchecked") @Override public boolean equals(final Object o) { if (!(o instanceof Entry)) { return false; } Entry<V> e = (Entry<V>)o; int k1 = getKey(); int k2 = e.getKey(); if (k1 == k2) { Object v1 = getValue(); Object v2 = e.getValue(); if ((v1 == v2) || ((v1 != null) && v1.equals(v2))) { return true; } } return false; }
s.writeInt(entry.getKey()); ComponentAndInterface cai = entry.getValue(); s.writeObject(cai.getComponent());
/** * @see java.lang.Object#equals(java.lang.Object) */ public boolean equals(Object o) { if (!(o instanceof Entry)) { return false; } Entry e = (Entry)o; int k1 = getKey(); int k2 = e.getKey(); if (k1 == k2) { Object v1 = getValue(); Object v2 = e.getValue(); if (v1 == v2 || (v1 != null && v1.equals(v2))) { return true; } } return false; }
/** * @see java.lang.Object#equals(java.lang.Object) */ @SuppressWarnings("unchecked") @Override public boolean equals(Object o) { if (!(o instanceof Entry)) { return false; } Entry<V> e = (Entry<V>)o; int k1 = getKey(); int k2 = e.getKey(); if (k1 == k2) { Object v1 = getValue(); Object v2 = e.getValue(); if (v1 == v2 || (v1 != null && v1.equals(v2))) { return true; } } return false; }
/** * @see java.util.Iterator#next() */ public Object next() { return new Integer(nextEntry().getKey()); } }
void putAllForCreate(IntHashMap m) { for (Iterator i = m.entrySet().iterator(); i.hasNext();) { Entry e = (Entry)i.next(); putForCreate(e.getKey(), e.getValue()); } }
/** * @see java.lang.Object#toString() */ @Override public String toString() { return getKey() + "=" + getValue(); //$NON-NLS-1$ } }
/** * @see java.util.AbstractCollection#contains(java.lang.Object) */ public boolean contains(Object o) { if (!(o instanceof Entry)) { return false; } Entry e = (Entry)o; Entry candidate = getEntry(e.getKey()); return candidate != null && candidate.equals(e); }
void putAllForCreate(IntHashMap<V> m) { for (Iterator<Entry<V>> i = m.entrySet().iterator(); i.hasNext();) { Entry<V> e = i.next(); putForCreate(e.getKey(), e.getValue()); } }
/** * @see java.lang.Object#toString() */ @Override public String toString() { return getKey() + "=" + getValue(); //$NON-NLS-1$ } }
void putAllForCreate(final IntHashMap<V> m) { for (Entry<V> entry : m.entrySet()) { putForCreate(entry.getKey(), entry.getValue()); } }
/** * @see java.lang.Object#toString() */ public String toString() { return getKey() + "=" + getValue(); //$NON-NLS-1$ } }