]> granicus.if.org Git - icu/commitdiff
ICU-10576 fix suboptimal if statement code in setBooleanAttribute
authorScott Russell <DTownSMR@gmail.com>
Mon, 6 Jan 2014 21:23:13 +0000 (21:23 +0000)
committerScott Russell <DTownSMR@gmail.com>
Mon, 6 Jan 2014 21:23:13 +0000 (21:23 +0000)
X-SVN-Rev: 34831

icu4j/main/classes/core/src/com/ibm/icu/text/DateFormat.java

index d8eda16b4e7032e913c34d6d8a2f847f83a86e17..58459b0db2a0cc052429510ae495ab35cdb4a56c 100644 (file)
@@ -1,5 +1,5 @@
 /*
- *   Copyright (C) 1996-2013, International Business Machines
+ *   Copyright (C) 1996-2014, International Business Machines
  *   Corporation and others.  All Rights Reserved.
  */
 
@@ -1488,11 +1488,14 @@ public abstract class DateFormat extends UFormat {
      */
     public DateFormat setBooleanAttribute(BooleanAttribute key, boolean value) 
     {
-        if(booleanAttributes.contains(key) && value == false)
-            booleanAttributes.remove(key);
-        
-        if(value == true && !booleanAttributes.contains(key))
+        if(value)
+        {
             booleanAttributes.add(key);
+        }
+        else
+        {
+            booleanAttributes.remove(key);
+        }
         
         return this;
     }