Currently, the equals
matcher recurses for Map
s and Iterable
s, but in a way that rejects circular references, while they are perfectly valid for certain applications.
The limit
argument is a cap on recursive calls and, as simple as it is, it works fine. But the correct handling of circular references is not to recurse, but to compare by ==
/identity. So, you should use a Set
when walking the data so as to watch for repeated iterables and avoid the silly recursion.