Stack: Difference between revisions
Content added Content deleted
Line 3,546: | Line 3,546: | ||
Of course, these stack semantics are not ''exclusive''. Elements of the list can still be accessed and manipulated in myriads of other ways. |
Of course, these stack semantics are not ''exclusive''. Elements of the list can still be accessed and manipulated in myriads of other ways. |
||
If you need exclusive stack semantics, you can use the <code>java.util.Stack</code> class, as demonstrated in the [[Stack#Java|Java]] example. |
|||
<syntaxhighlight lang="groovy">def stack = [] |
<syntaxhighlight lang="groovy">def stack = [] |
||
assert stack.empty |
assert stack.empty |