Unless your stack involves 5-10 JVM apps (with the smallest ones generally working at -Xmx512m but some expecting around 2-4 GiB), and your IDE is also a resource-hungry Java app, in which case the bare minimum is 32 GiB RAM + about 10 GiB of swap.
I want 64 GB but I will say for my current needs, 32 GB is the sweet spot. My normal daily use is around 20GB. And it is a MacBook Pro. One day I’ll probably go back to a laptop running Linux. It is the fastest for code compilation in my experience.
But it's not just memory, I find running code on MacOS generates a lot more heat causing the CPU to spike and harder to run in the first place.