[Use switch expression instead of If-Else]

I refactored the code using the new switch expression introduced since Java 12, which I used to make the code more concise and readable. This code uses Java's new switch expression to check each ResourceResolver subtype and set the corresponding boolean flag. The case L -> syntax allows us to concisely write the executable code for each case in a single line. Note that ignored is the variable used in the pattern matching, which is not actually used in this case. The variable name ignored is used to indicate that this variable is not actually used, meaning that we are only checking to see if it is of type VersionResourceResolver, and not interested in any particular instance of that type.

Refactoring the code in this way improves readability and allows us to omit the break statement that would have been required in a traditional switch statement.

[Changes to avoid unnecessary null checks]

"== null" check is a common and intuitive way to ensure that an object is not initialized in Java. However, I considered a different approach to improve the readability and maintainability of the code. In this code, the pathPrefixes field is initialized to a LinkedHashMap upon declaration, eliminating the need for a null check.

[Use switch expression where feasible]

In Java 12 and later versions, I use the new switch expression to make my code more concise.

Comment From: pivotal-cla

@only-juun Please sign the Contributor License Agreement!

Click here to manually synchronize the status of this Pull Request.

See the FAQ for frequently asked questions.

Comment From: pivotal-cla

@only-juun Thank you for signing the Contributor License Agreement!

Comment From: sbrannen

Hi @only-juun,

Congratulations on submitting your first PR for the Spring Framework! 👍

Unfortunately, we cannot accept the proposed changes (see my review comments for details), but we're looking forward to your next contribution.

Cheers,

Sam


Please note that you can disregard my requests to make changes to this PR. I posted the comments while reviewing the PR and didn't realize until afterwards that we would have to reject the entire PR.