Top "Peek" questions

Refers to a non-destructive operation performed on sequential, collection-like data structures that have the notion of "top element" or "next element", such as stacks, queues and streams.

Can I get an item from a PriorityQueue without removing it yet?

I want to get the next item in queue but I don't want to dequeue it. Is it possible in …

python python-3.x queue priority-queue peek
Get the number of bytes available in socket by 'recv' with 'MSG_PEEK' in C++

C++ has the following function to receive bytes from socket, it can check for number of bytes available with the …

c sockets buffer recv peek
In Java streams is peek really only for debugging?

I'm reading up about Java streams and discovering new things as I go along. One of the new things I …

java java-8 java-stream peek
How to properly use cin.peek()

This function is supposed to read a fraction and place it in an array. If the user enters '0' …

c++ struct cin peek
How to look ahead one element (peek) in a Python generator?

I can't figure out how to look ahead one element in a Python generator. As soon as I look it's …

python generator peek
Selecting specific object in queue ( ie peek +1)

if Peek returns the next object in a queue, is there a method I can use to get a specific …

c# queue peek
Reading specific number of bytes from a buffered reader in golang

I am aware of the specific function in golang from the bufio package. func (b *Reader) Peek(n int) ([]byte, …

go bufferedreader peek
C++ - Read file until reaching end of line with >> operators

I have looked around a lot, and still not found how to do this, so, please bear with me. Let's …

c++ operators ifstream peek end-of-line
C equivalent to fstream's peek

I know in C++, you're able to peek at the next character by using: in.peek();. How would I go …

c filestream stdio peek
C#: Using StreamReader to read line from txt file, but Peek() return -1 even there are a lot of lines left

I use Peek() method of StreamReader to check whether there are more lines need to be processed. There are more …

c# peek