DEV Community

Discussion on: Finding Null or Empty String Checks in Java

Collapse
 
monknomo profile image
Gunnar Gissel

That's in Apache Commons, right? It's a very useful library, and if I have it in a project already, I'm going to use it, but if I don't already have it, I won't. Guava is great too, and starting from scratch I generally toss it in.

In this particularly case I'm dealing with a large established code base that is politically resistant to new libraries. Being that it is established, it has many different patterns from different eras of development. The regex is part of an effort to track down some of those patterns and unify them, without adding a library. I think it is pretty obvious that you wouldn't use a regex to find a pattern of coding in a new project - this is for old projects that may not have always done it the right way.

I would be interested if you know of a better way to find more null or empty checks in strings than just adding to my regex when I find a new pattern