Base on SonarLint and IDEA suggestions, polishing the code.
- Reorder the modifiers to comply with the Java Language Specification.
- java:S4276 Refactor this code to use the more specialised Functional Interface 'UnaryOperator
' - Merge this if statement with the enclosing one.
- Use record for immutable classes.
Comment From: ZouHongxue
Rebase the commit, refer #30250
Comment From: sdeleuze
Thanks for your contribution, I merged a subset of those changes, without the one changing the public APIs and with the main goal of fixing HttpComponentsHeadersAdapter
null-safety.