David M. Lloyd wrote:

BTW, I'm sceptical about the claims within the javadoc for singleton() that the resultant set is serializable, as the field containing the element is final.

final is fine with serialisation. You can even provide a readObject and set it with ObjectInputStream.readObject (but only once!). However, you can't use readFields and then attempt to assign it (if you want to do that then you'll need readResolve - use a "serial proxy" as described in Effective Java 2nd Ed.).

Tom

Reply via email to