void removeMessage(final Validator validator, final List<? extends ValidationMessage> messages) {
		if(messages.isEmpty()) {
			return;
		}

		final int validatorHash = System.identityHashCode(validator);

		// if the validator is unknown by the map we haven't stored any messages for it yet that could be removed
		if(validatorToMessagesMap.containsKey(validatorHash)){
			final List<Integer> messageHashesOfThisValidator = validatorToMessagesMap.get(validatorHash);


			final List<Integer> hashesOfMessagesToRemove = messages.stream()
					.filter(m -> { // only those messages that are stored for this validator
						int hash = System.identityHashCode(m);
						return messageHashesOfThisValidator.contains(hash);
					})
					.map(System::identityHashCode) // we only need the hashCode here
					.collect(Collectors.toList());

			// only remove those messages that we have the hashCode stored
			getMessagesInternal().removeIf(message -> {
				int hash = System.identityHashCode(message);
				return hashesOfMessagesToRemove.contains(hash);
			});


			// we need to cleanup our internal map
			messageHashesOfThisValidator.removeAll(hashesOfMessagesToRemove);

			if(messageHashesOfThisValidator.isEmpty()) {
				validatorToMessagesMap.remove(validatorHash);
			}
		}
	}
void removeMessage(final Validator validator, final List<? extends ValidationMessage> messages) {
		if(messages.isEmpty()) {
			return;
		}

		final int validatorHash = System.identityHashCode(validator);

		
		if(validatorToMessagesMap.containsKey(validatorHash)){
			final List<Integer> messageHashesOfThisValidator = validatorToMessagesMap.get(validatorHash);


			final List<Integer> hashesOfMessagesToRemove = messages.stream()
					.filter(m -> { 
						int hash = System.identityHashCode(m);
						return messageHashesOfThisValidator.contains(hash);
					})
					.map(System::identityHashCode) 
					.collect(Collectors.toList());

			
			getMessagesInternal().removeIf(message -> {
				int hash = System.identityHashCode(message);
				return hashesOfMessagesToRemove.contains(hash);
			});


			
			messageHashesOfThisValidator.removeAll(hashesOfMessagesToRemove);

			if(messageHashesOfThisValidator.isEmpty()) {
				validatorToMessagesMap.remove(validatorHash);
			}
		}
	}
void removeMessage ( final Validator validator , final List < ? extends ValidationMessage > messages ) { if ( messages . isEmpty ( ) ) { return ; } final int validatorHash = System . identityHashCode ( validator ) ; // if the validator is unknown by the map we haven't stored any messages for it yet that could be removed if ( validatorToMessagesMap . containsKey ( validatorHash ) ) { final List < Integer > messageHashesOfThisValidator = validatorToMessagesMap . get ( validatorHash ) ; final List < Integer > hashesOfMessagesToRemove = messages . stream ( ) . filter ( m -> { // only those messages that are stored for this validator int hash = System . identityHashCode ( m ) ; return messageHashesOfThisValidator . contains ( hash ) ; } ) . map ( System :: identityHashCode ) // we only need the hashCode here . collect ( Collectors . toList ( ) ) ; // only remove those messages that we have the hashCode stored getMessagesInternal ( ) . removeIf ( message -> { int hash = System . identityHashCode ( message ) ; return hashesOfMessagesToRemove . contains ( hash ) ; } ) ; // we need to cleanup our internal map messageHashesOfThisValidator . removeAll ( hashesOfMessagesToRemove ) ; if ( messageHashesOfThisValidator . isEmpty ( ) ) { validatorToMessagesMap . remove ( validatorHash ) ; } } }
/*
Remove all given messages for the given validator.
/ * Remove all given messages for the given validator .