Change in ovirt-engine[master]: core: Improve LexoNumericComparator case-insensitive behavior
lvernia at redhat.com
lvernia at redhat.com
Mon Dec 1 08:00:50 UTC 2014
Lior Vernia has submitted this change and it was merged.
Change subject: core: Improve LexoNumericComparator case-insensitive behavior
......................................................................
core: Improve LexoNumericComparator case-insensitive behavior
It is generally bad to return 0 when comparing strings that aren't
identical - I can think of at least two good reasons.
Firstly, due to dysfunctional TreeSet behavior in Java (it uses a
comparator to tell whether two items are identical - this actually
breaks the contract of Set, which is guaranteed to only refer to items
as identical if they return the same hashCode() or true for equals()),
it is best to distinguish between non-identical strings even if
they're equal when compared case-insensitively.
Secondly, when collections of items are sorted, it's best to have a
deterministic order between them - otherwise "equal" rows may switch
places (e.g. upon refresh).
Change-Id: I097cdb5f4f784577586160f10c0ef151fc9c9b4f
Bug-Url: https://bugzilla.redhat.com/1167641
Signed-off-by: Lior Vernia <lvernia at redhat.com>
---
M backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/comparators/LexoNumericComparator.java
M backend/manager/modules/common/src/test/java/org/ovirt/engine/core/common/businessentities/comparators/LexoNumericComparatorTest.java
2 files changed, 28 insertions(+), 6 deletions(-)
Approvals:
Alona Kaplan: Looks good to me, approved
Lior Vernia: Verified
--
To view, visit http://gerrit.ovirt.org/35572
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I097cdb5f4f784577586160f10c0ef151fc9c9b4f
Gerrit-PatchSet: 2
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Lior Vernia <lvernia at redhat.com>
Gerrit-Reviewer: Alona Kaplan <alkaplan at redhat.com>
Gerrit-Reviewer: Lior Vernia <lvernia at redhat.com>
Gerrit-Reviewer: Moti Asayag <masayag at redhat.com>
Gerrit-Reviewer: automation at ovirt.org
Gerrit-Reviewer: oVirt Jenkins CI Server
More information about the Engine-commits
mailing list