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

java - How to pass parameters between Request-Scoped Controllers? -

actionscript 3 - Flex: moving a point with rotation doesnt change the point XY? -

ms access - C# - Using OleDbParameter on table name -