Массивы и коллекции

struct Queue<Element> {
    var items = [Element]()
    mutating func add(_ item: Element) {
        items.append(item)
    }
    mutating func poll() -> Element {
        return items.removeFirst()
    }
    func peek() -> Element? {
        return items.first
    }
}

var intQueue = Queue<Int>()
intQueue.add(1)
intQueue.add(3)
intQueue.add(5)

let top = intQueue.peek()!
//top is 1
let first = intQueue.poll()
//first is 1
let second = intQueue.poll()
//second is 3
let third = intQueue.poll()
//third is 5

print("top is \(top)")
print("first is \(first)")
print("second is \(second)")
print("third is \(third)")