It is not needed. As you pointed out, both do the same thing. Here is why...
In Java Regular expressions, \\
is a single backslash. Backslashes are used to escape the next character. The next character is a <
which does not need to be escaped, therefore the \\<
is redundant, and can be replaced with just <
.
Look here for characters that have special meaning and/or need to be escaped:
http://docs.oracle.com/javase/6/docs/api/java/util/regex/Pattern.html
Say you were trying to match a ?
instead of the <
, then you would use a regex like \\?
.
To match a single backslash, you would need 4 backslashes \\\\
in your regex.
Also note, If you were to type this line into an IDE like IntelliJ IDEA, it will highlight it and say:
Redundant character escape '\\<' in RegExp