From 32a260ff464384e874afb80e1bb1a21a0da32143 Mon Sep 17 00:00:00 2001 From: Sebastian Bazley Date: Thu, 6 Feb 2014 13:37:12 +0000 Subject: [PATCH] Don't assign parameter git-svn-id: https://svn.apache.org/repos/asf/commons/proper/lang/trunk@1565243 13f79535-47bb-0310-9956-ffa450edef68 --- src/main/java/org/apache/commons/lang3/Range.java | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/main/java/org/apache/commons/lang3/Range.java b/src/main/java/org/apache/commons/lang3/Range.java index 7a8655893..62d219c3a 100644 --- a/src/main/java/org/apache/commons/lang3/Range.java +++ b/src/main/java/org/apache/commons/lang3/Range.java @@ -140,25 +140,26 @@ public final class Range implements Serializable { * * @param element1 the first element, not null * @param element2 the second element, not null - * @param comparator the comparator to be used, null for natural ordering + * @param comp the comparator to be used, null for natural ordering */ @SuppressWarnings("unchecked") - private Range(final T element1, final T element2, Comparator comparator) { + private Range(final T element1, final T element2, final Comparator comp) { if (element1 == null || element2 == null) { throw new IllegalArgumentException("Elements in a range must not be null: element1=" + element1 + ", element2=" + element2); } - if (comparator == null) { - comparator = ComparableComparator.INSTANCE; + if (comp == null) { + this.comparator = ComparableComparator.INSTANCE; + } else { + this.comparator = comp; } - if (comparator.compare(element1, element2) < 1) { + if (this.comparator.compare(element1, element2) < 1) { this.minimum = element1; this.maximum = element2; } else { this.minimum = element2; this.maximum = element1; } - this.comparator = comparator; } // Accessors