Skip to content
Advertisement

Comparing the contents of two Treemaps

I have two TreeMaps that I want to compare. I currently have it written down like below but I feel like this could be written more efficiently. I tried looking in to comparators, but I don’t think that’s something I can use for my use-case.

The maps are Treemaps because the key must be case-insensitive.

JavaScript

Thanks in advance

Advertisement

Answer

If we have the two types AzureSecurityRule and ConfigSecurityRule we could make the comparison less verbose like this:

JavaScript
User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement