// Deletes a record, making the record number and associated disk // storage available for reuse. public void delete(int recNo) throws RecordNotFoundException;
and the data file has a flag for every record that indicates if the record is deleted or active, but based on the method's comment, every call to this method will delete the record from the file, meaning that the file will only have active records.
And for the create method: // Creates a new record in the database (possibly reusing a // deleted entry). Inserts the given data, and returns the record // number of the new record. public int create(String  data) throws DuplicateKeyException;
Then my question is, do I really need remove the record from the file? It does not make sense to me, to have a flag when all records are valid, am I missing something here?
Is a solution to,mark the record deleted on memory (using the flag value for it) and write the flag byte on disk and when a new record needs to be created you can find the first deleted record from the collection and overwrite it on memory and permament storage ???
The delete method will mark a record as deleted, that removes the record from the database. You could also overwrite all the fields with garbage for security reasons (or as an extra indication it's really gone), but IMO that goes beyond the scope of the assignment.
I just mark the record as deleted myself, and add the record ID to an internal list of deleted records I keep in the server. The latter too isn't strictly needed but makes it a lot faster to find places to store new records (if there's space in that list I don't have to search through the entire file to find an empty spot).