Java regex patterns - compile time constants or instance members?
- by KepaniHaole
Currently, I have a couple of singleton objects where I'm doing matching on regular expressions, and my Patterns are defined like so:
class Foobar {
private final Pattern firstPattern =
Pattern.compile("some regex");
private final Pattern secondPattern =
Pattern.compile("some other regex");
// more Patterns, etc.
private Foobar()…