Stack: Difference between revisions

145 bytes added ,  1 month ago
m
 
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.
 
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 = []
assert stack.empty
1

edit