public void ours() { ourSet.forEach(proc); }
private void writeObject(ObjectOutputStream stream) throws IOException { stream.defaultWriteObject(); // number of entries stream.writeInt(_size); SerializationProcedure writeProcedure = new SerializationProcedure(stream); if (! forEach(writeProcedure)) { throw writeProcedure.exception; } }
/** * Returns a new array containing the objects in the set. * * @return an <code>Object[]</code> value */ public Object[] toArray() { Object[] result = new Object[size()]; forEach(new ToObjectArrayProcedure(result)); return result; }
/** * Returns a typed array of the objects in the set. * * @param a an <code>Object[]</code> value * @return an <code>Object[]</code> value */ public Object[] toArray(Object[] a) { int size = size(); if (a.length < size) a = (Object[])java.lang.reflect.Array.newInstance(a.getClass().getComponentType(), size); forEach(new ToObjectArrayProcedure(a)); Iterator it = iterator(); for (int i=0; i<size; i++) { a[i] = it.next(); } if (a.length > size) { a[size] = null; } return a; }