From EL 2.2 specification (get the one below “Click here to download the spec for evaluation”):
1.10 Empty Operator –
empty AThe
emptyoperator is a prefix operator that can be used to determine if a value is
null or empty.To evaluate
empty A
- If
Aisnull, returntrue- Otherwise, if
Ais the empty string, then returntrue- Otherwise, if
Ais an empty array, then returntrue- Otherwise, if
Ais an emptyMap, returntrue- Otherwise, if
Ais an emptyCollection, returntrue- Otherwise return
false
So, considering the interfaces, it works on Collection and Map only. In your case, I think Collection is the best option. Or, if it’s a Javabean-like object, then Map. Either way, under the covers, the isEmpty() method is used for the actual check. On interface methods which you can’t or don’t want to implement, you could throw UnsupportedOperationException.