// Java can guarantee that the Object read back // is indeed an ArrayList of some sort of Objects, just not what type of Objects. // The array internal to the ArrayList is Object[], not Thing[], so that is no help // in ensuring the Object read back is an ArrayList<Thing>. // We verify the objects in the ArrayList individually. // This is safer but considerably slower than suppressing the error message. // Does not generate a cast warning. final ArrayList<Object> temp = (ArrayList<Object>)ois.readObject(); final ArrayList<Thing>things = new ArrayList<Thing>( temp.size() ); for ( Object item : temp ) { things.add( (Thing)item ); }