Lior Vernia has posted comments on this change.

Change subject: webadmin: Nic labels should be sorted
......................................................................


Patch Set 2: Code-Review+2

(1 comment)

http://gerrit.ovirt.org/#/c/28885/2/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/widget/host/InterfaceLabelWithToolTip.java
File 
frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/widget/host/InterfaceLabelWithToolTip.java:

Line 45:         if (labels == null) {
Line 46:             return null;
Line 47:         }
Line 48: 
Line 49:         String[] sortedLabels = labels.toArray(new String[] {});
> Why is it better?
In this specific case, it isn't, it's exactly equivalent.

In general, Collections are at least as good as arrays and usually better:
http://stackoverflow.com/questions/6100148/collection-interface-vs-arrays

So I don't see any reason to ever use arrays, other than for convenient 
initialization (e.g. new String[] { "foo", "bar" }).

If it's important for you to use an array in this case, I don't mind.
Line 50:         Arrays.sort(sortedLabels);
Line 51: 
Line 52:         for (String label : sortedLabels) {
Line 53:             if (isFirst) {


-- 
To view, visit http://gerrit.ovirt.org/28885
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: I28fb7750504bffdadd9d92f00565e21c272127ff
Gerrit-PatchSet: 2
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Alona Kaplan <[email protected]>
Gerrit-Reviewer: Alona Kaplan <[email protected]>
Gerrit-Reviewer: Lior Vernia <[email protected]>
Gerrit-Reviewer: [email protected]
Gerrit-Reviewer: oVirt Jenkins CI Server
Gerrit-HasComments: Yes
_______________________________________________
Engine-patches mailing list
[email protected]
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to