MCPcopy Create free account
hub / github.com/TheAlgorithms/Go / Front

Method Front

structure/deque/deque.go:59–65  ·  view source on GitHub ↗

Front gets the front item from queue.

()

Source from the content-addressed store, hash-verified

57
58// Front gets the front item from queue.
59func (dq *DoublyEndedQueue[T]) Front() (T, error) {
60 if (len(dq.deque)) == 0 {
61 var zeroVal T
62 return zeroVal, ErrEmptyDequeue
63 }
64 return dq.deque[0], nil
65}
66
67// Rear gets the last item from queue.
68func (dq *DoublyEndedQueue[T]) Rear() (T, error) {

Callers 1

TestDequeFunction · 0.45

Calls

no outgoing calls

Tested by 1

TestDequeFunction · 0.36