Card identification in groovy

When porting a piece of code from python, I came across a trivial problem:

if isinstance(v['content'], dict):

What would be the most elegant way to port this to groovy?

+3
source share
1 answer

You can use instanceof(see map example here ), for example:

if (v['content'] instanceof java.util.map)
+5
source

Source: https://habr.com/ru/post/1706104/


All Articles