Access to the leafs of Composite pattern Java
<p>I implement the Composite pattern for represent a tree of elements like in the picture:
<a href="https://i.stack.imgur.com/2rE0E.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/2rE0E.png" alt="enter image description here"></a></p>

<p>But how I can access to the leafs of this tree, like a List of Leaf. Should I implement Visitor?</p>