Does the JavaMail search library simply just iterate thru a Folder.getMessages() call and perform comparisons?

John Zukowski

For IMAP, the search turns into a command that's sent to the server, where the real search happens, using whatever optimizations the IMAP server might implement.

For POP3, the search happens locally, as described.