Serializable to the extends
interface lists of Collection,
Cell, Keyed, Comparator,
Predicate, and Function.
HashedSet
private void readObject(java.io.ObjectInputStream stream)
throws java.io.IOException, ClassNotFoundException
{
int len = stream.readInt();
if (len > 0)
table_ = new LLCell[len];
else
table_ = null;
loadFactor_ = stream.readFloat();
int count = stream.readInt();
while (count-- > 0) {
Object element = stream.readObject();
int h = hashOf(element);
LLCell hd = table_[h];
LLCell n = new LLCell(element, hd);
table_[h] = n;
}
}
private void writeObject(java.io.ObjectOutputStream stream)
throws java.io.IOException
{
int len;
if (table_ != null)
len = table_.length;
else
len = 0;
stream.writeInt(len);
stream.writeFloat(loadFactor_);
stream.writeInt(count_);
if (len > 0) {
Enumeration e = elements();
while (e.hasMoreElements()) stream.writeObject(e.nextElement());
}
}
HashedMap, adding:
private void readObject(java.io.ObjectInputStream stream)
throws java.io.IOException, ClassNotFoundException
{
int len = stream.readInt();
if (len > 0)
table_ = new LLPair[len];
else
table_ = null;
loadFactor_ = stream.readFloat();
int count = stream.readInt();
while (count-- > 0) {
Object key = stream.readObject();
Object element = stream.readObject();
int h = hashOf(key);
LLPair hd = table_[h];
LLPair n = new LLPair(key, element, hd);
table_[h] = n;
}
}
private void writeObject(java.io.ObjectOutputStream stream)
throws java.io.IOException
{
int len;
if (table_ != null)
len = table_.length;
else
len = 0;
stream.writeInt(len);
stream.writeFloat(loadFactor_);
stream.writeInt(count_);
if (len > 0) {
Enumeration keys = keys();
Enumeration elements = elements();
while (keys.hasMoreElements()) {
stream.writeObject(keys.nextElement());
stream.writeObject(elements.nextElement());
}
}
}