Skip to content
Advertisement

Guava Maps.difference with wildcard

I want to use Guava’s Maps.difference in java 11 to verify data from Json String which I mapped into a Map.

What I have after a call (with different uid each time) :

JavaScript

I want to verify that uid is correctly generated and name is “Jean” using a pattern like this :

JavaScript

Of course Maps.difference returns a difference in uid value…

Is it possible to specify a wildcard in my verifying pattern so that Maps.difference returns no differences ?

Thanks in advance.

Advertisement

Answer

Assuming you mean Guava’s Maps.difference: yes, use the difference(left, right, valueEquivalence) overload:

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