question: private void assertBounded ( SortedSet < String > deserialized , boolean bounded ) { if ( bounded ) { try { deserialized . add ( "e" ) ; fail ( ) ; } catch ( IllegalArgumentException expected ) { } } else { assertTrue ( deserialized . add ( "e" ) ) ; assertTrue ( deserialized . remove ( "e" ) ) ; } }
target:  Regrettably, serializing a TreeSet causes it to forget its bounds. This is unlike a serialized TreeMap which retains its bounds when serialized.