Creates a stack. Mutable. Use Stacks.immutable for an immutable alternative.
// Createconst s = Stacks.mutable();// Add one or more itemss.push(1, 2, 3, 4);// See what's on tops.peek; // 4// Remove the top-most, and return its.pop(); // 4// Now there's a new top-most elements.peek; // 3 Copy
// Createconst s = Stacks.mutable();// Add one or more itemss.push(1, 2, 3, 4);// See what's on tops.peek; // 4// Remove the top-most, and return its.pop(); // 4// Now there's a new top-most elements.peek; // 3
Rest
Creates a stack. Mutable. Use Stacks.immutable for an immutable alternative.
Example: Basic usage