mirror of
https://github.com/unicode-org/icu.git
synced 2025-04-10 07:39:16 +00:00
ICU-10576 fix suboptimal if statement code in setBooleanAttribute
X-SVN-Rev: 34831
This commit is contained in:
parent
b40d690f2a
commit
d72df4a157
1 changed files with 8 additions and 5 deletions
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue