mardi 21 mars 2017

Java: Why is a Matcher called Matcher and not Matches

Using regular expression in Java with Pattern and Matcher classes is easy; however, each time I want to use it, I have to go back and review the steps. I think one big reason for this is that the name "matcher" used for both the class and the method is a misnomer. I think a better name would have been Match, and match().

Does anyone have any explanation as to why they picked the names Matcher, and matcher()? If I know, then I might be able to keep the steps in memory rather than having to refer to documentation each time I want to use regex in Java.

Aucun commentaire:

Enregistrer un commentaire