java - Correct Exception to throw when a duplicate key insertion is attempted? -



java - Correct Exception to throw when a duplicate key insertion is attempted? -

repeatedly see comments avoiding throwing generic runtimeexception , trying follow guideline.

i have class aggregates sortedmap property setting allow or disallow duplicate keys. trying figure out exception should throw when duplicate keys disallowed , effort made add together one.

i checked java docs exception class , none of known direct descendants seemed suitable. go ahead , create own eduplicatemapkey class illustration , throw that? if so, how avoid ending big pile of class files, 1 each custom exception type?

what considered "best practice" here?

create own exception. illustration java ee has duplicatekeyexception, can similar custom map.

java exception-handling

Comments

Popular posts from this blog

iphone - Dismissing a UIAlertView -

c# - Can ProtoBuf-Net deserialize to a flat class? -

javascript - Change element in each JQuery tab to dynamically generated colors -