Pettern.matcher(String).matches

· TIL
문제 String.matches(regex) 는 왜 반복사용시 Pattern.matcher(string).matches() 보다 느릴까 깃허브에서 추천을 타고타고 보다보면 다른 사람들이 코드리뷰 해놓은 것들도 볼 수 있는데, 그중에 종종 보이는게 String.matches는 느려서 Pattern 을 static 으로 해두고 써야해요! 라는 내용이 있다. ㅈㅎ님 코드리뷰를 하던 중에 마침 String.matches 를 써둔 게 있길래 리뷰의 근거를 마련하기 위해? 얼마나 느린지, 왜 느린지를 정리해보려고 한다. private static final Pattern PATTERN = Pattern.compile(".*[0-9].*"); static Function validateNumberWithPattern..
yunjae62
'Pettern.matcher(String).matches' 태그의 글 목록