Linux find command - reverse the meaning of a file search

Summary: How to reverse the meaning of a Linux find command.

I spent last night doing a bunch of work on my source code warehouse. At the end of the night I needed to do a search for all files in many subdirectories whose filenames did not end with "*.java". It's easy enough to find filenames that do end with "*.java", using the find command like this:

find . -type f -name "*.java"

but I needed to do the exact opposite of this. Fortunately you can easily do this with the find command "not" operator, like this:

find . -type f not -name "*.java"

or this:

find . -type f ! -name "*.java"

This find command returns a complete list of all filenames that do not end with the ".java" file extension, and was exactly what I needed.

If you'd like an advanced exercise, this following command seemed to work for searching for filenames that did not match multiple extensions, specifically "*.java" or "*.html":

find . -type f ! -name "*.java" ! -name "*.html"

I suspect that there is an even easier way to do this, but I don't know what that is right now.