saving java data structures before deleting them