mbien commented on a change in pull request #3676:
URL: https://github.com/apache/netbeans/pull/3676#discussion_r815247634



##########
File path: 
platform/api.search/src/org/netbeans/api/search/provider/SearchInfo.java
##########
@@ -125,15 +125,8 @@
             @NonNull final SearchScopeOptions options,
             @NonNull final SearchListener listener,
             @NonNull final AtomicBoolean terminated) {
-
-        return new Iterable<FileObject>() {
-
-            @Override
-            public Iterator<FileObject> iterator() {
-                return createFilesToSearchIterator(options, listener,
-                        terminated);
-            }
-        };
+        return () -> createFilesToSearchIterator(options, listener,
+                terminated);

Review comment:
       This is just a nitpick but, since modern java is quite a bit more 
compact, I think you could remove the line break here and other places (esp if 
there is just a single word and a closing bracket on the new line). 
   
   I am not suggesting to format everything (please don't :)), just the worst 
offenders in the areas you changed and which became more compact.

##########
File path: 
platform/api.search/src/org/netbeans/modules/search/ui/ResultsOutlineCellRenderer.java
##########
@@ -58,24 +58,29 @@ public Component getTableCellRendererComponent(JTable 
table, Object value,
             Property<?> property = (Property<?>) value;
             try {
                 String valueString = getDisplayValue(property);
-                if (property.getName().equals("path")) { //NOI18N
-                    renderer = super.getTableCellRendererComponent(table,
-                            computeFitText(table, row, column, valueString),
-                            isSelected, hasFocus, row, column);
-                    setToolTip(renderer, property);
-                } else if (property.getName().equals("size")) {         
//NOI18N
-                    renderer = super.getTableCellRendererComponent(table,
-                            formatFileSize((Long) property.getValue()),
-                            isSelected, hasFocus, row, column);
-                    setToolTip(renderer, property);
-                } else if (property.getName().equals("lastModified")) { 
//NOI18N
-                    renderer = super.getTableCellRendererComponent(table,
-                            formatDate((Date) property.getValue()),
-                            isSelected, hasFocus, row, column);
-                    setToolTip(renderer, property);
-                } else {
-                    renderer = super.getTableCellRendererComponent(table,
+                switch (property.getName()) {

Review comment:
       this is potentially dangerous since `name` could be null, and switch 
doesn't like null.
   
   We could keep the old if-else chain here, until we rise the language level 
far enough that we can use the new switch syntax, which tolerates null. There 
is not much gained readability wise and this also doesn't look like performance 
sensitive code, so i think we can live with if-else here (for now).




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists

Reply via email to