Checking for Documenta and Document list


In my code i need to check whether the input coming is a documet or a document list and the make flow logic accordingly.

The structure of the input is’

<“Document List A”>
<“Document B”>

In this structure Document B can vary i.e it can either be a document or a document list. The logic further to this needs to check if the value at is document or document list.

Please suggest way how this can be done as the sizeOfList fails in case input (Which is dynamic) is document.