I guess it depends on the type of collection and on how you interpret the original question.
I interpreted "key" to mean a database key, not a key-value pair in a map. More specifically, I was referring to duplicate keys/records in the data file itself. Since it is a flat file instead of a true database, we are left to define our own key (or none at all if we so choose). I am using a RandomAccessFile to access the data, and I decided not to implement a cache.
The way I interpreted the DuplicateKeyException was it would be thrown if two records existed containing the same primary key (which I defined as the entire record). In this case, it is very possible for a user to modify a record so its key matches one that already exists.
“Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.” - Rich Cook