Class DuplicateValueException

All Implemented Interfaces:
Serializable

public class DuplicateValueException extends RuntimeException
Indicates that insertion into a Map, Set or some other uniqueness-enforcing data structure failed because the value to be inserted turned out to be a duplicate. Klojang Check does not itself ever throw a DuplicateValueException, but the error condition it represents is general and important enough to merit inclusion as a common exception in the CommonExceptions class.

 Check.that(arg).isNot(keyIn(), map, duplicateKey(arg));
 
See Also:
  • Constructor Details

    • DuplicateValueException

      public DuplicateValueException()
      Default constructor.
    • DuplicateValueException

      public DuplicateValueException(String message)
      Creates a new DuplicateValueException with the specified message.
      Parameters:
      message - the message
    • DuplicateValueException

      public DuplicateValueException(DuplicateValueException.Usage usage)
      Creates a new DuplicateValueException.
      Parameters:
      usage - the intended usage of the value
    • DuplicateValueException

      public DuplicateValueException(DuplicateValueException.Usage usage, Object duplicate)
      Creates a new DuplicateValueException for the specified value.
      Parameters:
      usage - the intended usage of the value
      duplicate - the duplicate value.
    • DuplicateValueException

      public DuplicateValueException(DuplicateValueException.Usage usage, Collection<Object> duplicates)
      Creates a new DuplicateValueException for the specified values.
      Parameters:
      usage - the intended usage of the values
      duplicates - the duplicate values.