It may be an opinion, but pointing it out won’t make me like java any more.
If I find myself repeating more than twice, I just ask “Can this be a function”. If yes, I move it there. If not, I just leave it as it is.
Life’s too short to spend all day rewriting your code.
It may be an opinion, but pointing it out won’t make me like java any more.