Loop on maps to find duplicate
Sharon Ben Asher has a good answer using streams. I'd like to add some suggestions for the original code, since beginners are often not familiar with streams in Java.

You have some redundancy in your code, meaning code that is executed multiple times, which can hurt readability, decrease performance and introduce bugs. To tackle the issue, you can save results from method calls in variables and just access the variables multiple times. This also allows you to give the result a new name, and although it might make the code slightly longer in terms of lines of code, it can also make it a lot cleaner, and the individual lines shorter.

The most important example is calling property.getKey() and property.getValue() multiple times. Instead, do that at the beginning of the loop, and save the results in variables.

for (Map.Entry&lt;String, Object&gt; property : properties.entrySet()) {
    String key = property.getKey();
    Object value = property.getValue();


Then you access them in your code, which makes it easier to see where the same values are used. You are using the same method call to access another element of a different map, so again you can use a variable to save the result and make the code clearer and shorter:

    if (existingProperties.containsKey(key)) {
        Object existingObject = existingProperties.get(key);
        if (existingObject instanceof String &amp;&amp; value instanceof String) {
            String existingValue = (String) existingObject;
            String newValue = (String) value;


We can improve readability by formatting very long lines (like that long string concatenation) on 2 or 3 lines, introducing newlines where we can devide it into logical parts:

            if (existingValue.equals(newValue)) {
                throw new Exception("Property " + key +
                                    " is existing with value " + newValue +
                                    " in requires " + requiresName);
            }


By the way, there seems to have been a space missing at the start of the string "in requires ", and a typo in " is existsing with value ".