El martes, 13 de septiembre de 2016, 17:16:19 (UTC-4), Júlio Hoffimann escribió: > > Hi, > > Could you explain why "peek" returns the pair (key,value) whereas > "dequeue!" only returns the key? > > using Base.Collections > pq = PriorityQueue() > enqueue!(pq, key, value) > key, value = Collections.peek(pq) > key = dequeue!(pq) > > I wanted to have a single line in which I retrieve both (key,value) and at > the same time remove the pair from the collection: > > key, value = dequeue!(pq) > > Should I open an issue on GitHub? >
I also wondered that at some point. Yes please to an issue. It also seems to me that for consistency, this should be called pop! rather than dequeue!, and enqueue! should be push! > > -Júlio >
