protected final void serialize(ObjectOutputStream oos,Collection coll) throws IOException {
  int count=0;
  Object[] objects=coll.toArray();
  for (int i=0; i < objects.length; i++) {
    if (objects[i] instanceof Serializable)     count++;
 else     objects[i]=null;
  }
  oos.writeInt(count);
  for (int i=0; count > 0; i++) {
    Object o=objects[i];
    if (o != null) {
      oos.writeObject(o);
      count--;
    }
  }
}

protected final void serialize ( ObjectOutputStream oos , Collection coll ) throws IOException { int count = 0 ; Object [ ] objects = coll . toArray ( ) ; for ( int i = 0 ; i < objects . length ; i ++ ) { if ( objects [ i ] instanceof Serializable ) count ++ ; else objects [ i ] = null ; } oos . writeInt ( count ) ; for ( int i = 0 ; count > 0 ; i ++ ) { Object o = objects [ i ] ; if ( o != null ) { oos . writeObject ( o ) ; count -- ; } } }
used by writeobject to serialize a collection .
