You are correct. The actual pattern you want to use in practice with this API is more of a do ... while:
WIN32_FIND_DATA data;
HANDLE handle;
handle = FindFirstFile(str, &data);
// TODO - error check
do
{
// TODO: process "data" which is a file.
} while (FindNextFile(handle, &data));
FindClose(handle);
So the loop body is the same for the "first" and "next" files.
In C++, you have
In Java you have Similarly with FindFile you have (leaving off some parameters) Separating the creation of the iterator from advancing the iterator is a good thing.