Conversation
Signed-off-by: subhramit <subhramit.bb@live.in>
Signed-off-by: subhramit <subhramit.bb@live.in>
Signed-off-by: subhramit <subhramit.bb@live.in>
Signed-off-by: subhramit <subhramit.bb@live.in>
PR Compliance Guide 🔍Below is a summary of compliance checks for this PR:
Compliance status legend🟢 - Fully Compliant🟡 - Partial Compliant 🔴 - Not Compliant ⚪ - Requires Further Human Verification 🏷️ - Compliance label |
|||||||||||||||||||||||
PR Code Suggestions ✨Explore these optional code suggestions:
|
||||||||||||
Signed-off-by: subhramit <subhramit.bb@live.in>
| public List<String> getFieldNames() { | ||
| if (entryEditor.getCurrentlyEditedEntry() == null) { | ||
| return Collections.emptyList(); | ||
| return List.of(); |
There was a problem hiding this comment.
Collections.emptyLIst returns an immutable list
There was a problem hiding this comment.
| this( | ||
| EnumSet.of(SidePaneType.WEB_SEARCH, SidePaneType.GROUPS), // Default visible panes (OPEN_OFFICE omitted) | ||
| Collections.emptyMap(), // Default preferred positions | ||
| Map.of(), // Default preferred positions |
There was a problem hiding this comment.
Same as above, Collections.emptyMap is better
Siedlerchr
left a comment
There was a problem hiding this comment.
Collections.empty... better transfers the semantic that we expect an immutable list
It was just to maintain consistency with the rest of the places where we return empty lists (whether in code or tests) |
Yes - also immutable - https://apidia.net/java/OpenJDK/25/?pck=java.util&cls=.Collections As usual, I point to Eclipse Collections (https://eclipse.dev/collections/), which have the mutability and immutability explicitly. |
This is beautiful. // Java Streams
list.stream()
.filter(x -> x > 5)
.map(x -> x * 2)
.collect(Collectors.toList());
// Eclipse Collections
list.select(x -> x > 5)
.collect(x -> x * 2); |
|
The main branch is failing now |
yeah it is unrelated: |
|
For reference: An LTWA workaround was added at #14892 |


User description
List.of()andMap.of()instead ofCollections.emptlyList()andCollections.emptyMap()varSteps to test
Mandatory checks
CHANGELOG.mdin a way that is understandable for the average user (if change is visible to the user)PR Type
Enhancement
Description
Replace
Collections.emptyList()andCollections.emptyMap()with modernList.of()andMap.of()Replace
varkeyword with explicit type declarations throughout codebaseAdd missing import statements for explicit types
Improve code readability and maintainability
Diagram Walkthrough
File Walkthrough
12 files
Replace var with explicit InputStream typeReplace Collections.emptyList with List.ofReplace var with explicit type declarationsReplace Collections.emptyMap with Map.ofReplace var with explicit Optional typeReplace Collections.emptyList with List.ofReplace var with explicit PrintStream typesReplace Collections.emptyMap with Map.ofReplace var with explicit ProgressInputStream typeReplace var with explicit LinkedHashSet typeReplace var with explicit List type declarationReplace var with explicit List type declaration