Does Ruby have containers like stacks, queues, linked-lists, maps, or sets?

(Moved from Comment)

Well, an array can be a stack or queue by limiting yourself to stack or queue methods (push, pop, shift, unshift). Using push / pop gives LIFO(last in first out) behavior (stack), while using push / shift or unshift / pop gives FIFO behavior (queue).

Maps are hashes, and a Set class already exists.

You could implement a linked list using classes, but arrays will give linked-list like behavior using the standard array methods.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)