Dequeue will be removed the first value that input (First In First Out - FIFO)
()
| 28 | |
| 29 | // Dequeue will be removed the first value that input (First In First Out - FIFO) |
| 30 | func (lq *LQueue) Dequeue() error { |
| 31 | |
| 32 | if !lq.Empty() { |
| 33 | element := lq.queue.Front() |
| 34 | lq.queue.Remove(element) |
| 35 | |
| 36 | return nil |
| 37 | } |
| 38 | |
| 39 | return fmt.Errorf("dequeue is empty we got an error") |
| 40 | } |
| 41 | |
| 42 | // Front it will return the front value |
| 43 | func (lq *LQueue) Front() (any, error) { |