ICU-8854 use of inefficient Number constructors. Use valueOf.

X-SVN-Rev: 30856
This commit is contained in:
Abhinav Gupta 2011-10-24 19:14:19 +00:00
parent 7f0d45c7ad
commit 87f031cd34
3 changed files with 21 additions and 21 deletions

View File

@ -789,7 +789,7 @@ final class CollationParsedRuleBuilder {
MaxJamoExpansionTable() { MaxJamoExpansionTable() {
m_endExpansionCE_ = new ArrayList<Integer>(); m_endExpansionCE_ = new ArrayList<Integer>();
m_isV_ = new ArrayList<Boolean>(); m_isV_ = new ArrayList<Boolean>();
m_endExpansionCE_.add(new Integer(0)); m_endExpansionCE_.add(Integer.valueOf(0));
m_isV_.add(Boolean.FALSE); m_isV_.add(Boolean.FALSE);
m_maxLSize_ = 1; m_maxLSize_ = 1;
m_maxVSize_ = 1; m_maxVSize_ = 1;
@ -811,8 +811,8 @@ final class CollationParsedRuleBuilder {
MaxExpansionTable() { MaxExpansionTable() {
m_endExpansionCE_ = new ArrayList<Integer>(); m_endExpansionCE_ = new ArrayList<Integer>();
m_expansionCESize_ = new ArrayList<Byte>(); m_expansionCESize_ = new ArrayList<Byte>();
m_endExpansionCE_.add(new Integer(0)); m_endExpansionCE_.add(Integer.valueOf(0));
m_expansionCESize_.add(new Byte((byte) 0)); m_expansionCESize_.add(Byte.valueOf((byte) 0));
} }
MaxExpansionTable(MaxExpansionTable table) { MaxExpansionTable(MaxExpansionTable table) {
@ -1030,9 +1030,9 @@ final class CollationParsedRuleBuilder {
m_maxExpansions_ = maxet; m_maxExpansions_ = maxet;
// adding an extra initial value for easier manipulation // adding an extra initial value for easier manipulation
for (int i = 0; i < RuleBasedCollator.UCA_.m_expansionEndCE_.length; i++) { for (int i = 0; i < RuleBasedCollator.UCA_.m_expansionEndCE_.length; i++) {
maxet.m_endExpansionCE_.add(new Integer( maxet.m_endExpansionCE_.add(Integer.valueOf(
RuleBasedCollator.UCA_.m_expansionEndCE_[i])); RuleBasedCollator.UCA_.m_expansionEndCE_[i]));
maxet.m_expansionCESize_.add(new Byte( maxet.m_expansionCESize_.add(Byte.valueOf(
RuleBasedCollator.UCA_.m_expansionEndCEMaxSize_[i])); RuleBasedCollator.UCA_.m_expansionEndCEMaxSize_[i]));
} }
m_maxJamoExpansions_ = maxjet; m_maxJamoExpansions_ = maxjet;
@ -2170,7 +2170,7 @@ final class CollationParsedRuleBuilder {
* @return the current position of the new element * @return the current position of the new element
*/ */
private static final int addExpansion(List<Integer> expansions, int value) { private static final int addExpansion(List<Integer> expansions, int value) {
expansions.add(new Integer(value)); expansions.add(Integer.valueOf(value));
return expansions.size() - 1; return expansions.size() - 1;
} }
@ -2219,14 +2219,14 @@ final class CollationParsedRuleBuilder {
// is smaller // is smaller
Object currentsize = maxexpansion.m_expansionCESize_.get(result); Object currentsize = maxexpansion.m_expansionCESize_.get(result);
if (((Byte) currentsize).byteValue() < expansionsize) { if (((Byte) currentsize).byteValue() < expansionsize) {
maxexpansion.m_expansionCESize_.set(result, new Byte( maxexpansion.m_expansionCESize_.set(result, Byte.valueOf(
expansionsize)); expansionsize));
} }
} else { } else {
// we'll need to squeeze the value into the array. initial // we'll need to squeeze the value into the array. initial
// implementation. shifting the subarray down by 1 // implementation. shifting the subarray down by 1
maxexpansion.m_endExpansionCE_.add(start + 1, new Integer(endexpansion)); maxexpansion.m_endExpansionCE_.add(start + 1, Integer.valueOf(endexpansion));
maxexpansion.m_expansionCESize_.add(start + 1, new Byte(expansionsize)); maxexpansion.m_expansionCESize_.add(start + 1, Byte.valueOf(expansionsize));
} }
return maxexpansion.m_endExpansionCE_.size(); return maxexpansion.m_endExpansionCE_.size();
} }
@ -2280,7 +2280,7 @@ final class CollationParsedRuleBuilder {
return maxexpansion.m_endExpansionCE_.size(); return maxexpansion.m_endExpansionCE_.size();
} }
} }
maxexpansion.m_endExpansionCE_.add(new Integer(endexpansion)); maxexpansion.m_endExpansionCE_.add(Integer.valueOf(endexpansion));
maxexpansion.m_isV_.add(isV ? Boolean.TRUE : Boolean.FALSE); maxexpansion.m_isV_.add(isV ? Boolean.TRUE : Boolean.FALSE);
return maxexpansion.m_endExpansionCE_.size(); return maxexpansion.m_endExpansionCE_.size();
@ -2519,7 +2519,7 @@ final class CollationParsedRuleBuilder {
element = table.m_elements_.size() - 1; element = table.m_elements_.size() - 1;
} }
tbl.m_CEs_.add(new Integer(value)); tbl.m_CEs_.add(Integer.valueOf(value));
tbl.m_codePoints_.append(codePoint); tbl.m_codePoints_.append(codePoint);
return constructSpecialCE(table.m_currentTag_, element); return constructSpecialCE(table.m_currentTag_, element);
} }
@ -2714,7 +2714,7 @@ final class CollationParsedRuleBuilder {
} }
} }
if (codePoint == tbl.m_codePoints_.charAt(position)) { if (codePoint == tbl.m_codePoints_.charAt(position)) {
tbl.m_CEs_.set(position, new Integer(newCE)); tbl.m_CEs_.set(position, Integer.valueOf(newCE));
return element & 0xFFFFFF; return element & 0xFFFFFF;
} else { } else {
return CE_NOT_FOUND_; return CE_NOT_FOUND_;
@ -2745,7 +2745,7 @@ final class CollationParsedRuleBuilder {
element = table.m_elements_.size() - 1; element = table.m_elements_.size() - 1;
} }
tbl.m_CEs_.set(offset, new Integer(value)); tbl.m_CEs_.set(offset, Integer.valueOf(value));
tbl.m_codePoints_.setCharAt(offset, codePoint); tbl.m_codePoints_.setCharAt(offset, codePoint);
return constructSpecialCE(table.m_currentTag_, element); return constructSpecialCE(table.m_currentTag_, element);
} }
@ -2779,7 +2779,7 @@ final class CollationParsedRuleBuilder {
offset++; offset++;
} }
tbl.m_CEs_.add(offset, new Integer(value)); tbl.m_CEs_.add(offset, Integer.valueOf(value));
tbl.m_codePoints_.insert(offset, codePoint); tbl.m_codePoints_.insert(offset, codePoint);
return constructSpecialCE(table.m_currentTag_, element); return constructSpecialCE(table.m_currentTag_, element);
@ -2978,7 +2978,7 @@ final class CollationParsedRuleBuilder {
return 0; return 0;
} }
tbl.m_CEs_.set(tbl.m_CEs_.size() - 1, new Integer(value)); tbl.m_CEs_.set(tbl.m_CEs_.size() - 1, Integer.valueOf(value));
return constructSpecialCE(table.m_currentTag_, element & 0xFFFFFF); return constructSpecialCE(table.m_currentTag_, element & 0xFFFFFF);
} }
@ -3667,7 +3667,7 @@ final class CollationParsedRuleBuilder {
table.m_offsets_.clear(); table.m_offsets_.clear();
int position = 0; int position = 0;
for (int i = 0; i < tsize; i++) { for (int i = 0; i < tsize; i++) {
table.m_offsets_.add(new Integer(position)); table.m_offsets_.add(Integer.valueOf(position));
position += table.m_elements_.get(i).m_CEs_ position += table.m_elements_.get(i).m_CEs_
.size(); .size();
} }
@ -3701,7 +3701,7 @@ final class CollationParsedRuleBuilder {
if (isContractionTableElement(CEPointer.get(offset + j).intValue())) { if (isContractionTableElement(CEPointer.get(offset + j).intValue())) {
int ce = CEPointer.get(offset + j).intValue(); int ce = CEPointer.get(offset + j).intValue();
CEPointer.set(offset + j, CEPointer.set(offset + j,
new Integer(constructSpecialCE(getCETag(ce), Integer.valueOf(constructSpecialCE(getCETag(ce),
table.m_offsets_.get(getContractionOffset(ce)) table.m_offsets_.get(getContractionOffset(ce))
.intValue()))); .intValue())));
} }

View File

@ -1,6 +1,6 @@
/* /*
***************************************************************** *****************************************************************
* Copyright (c) 2002-2010, International Business Machines Corporation * Copyright (c) 2002-2011, International Business Machines Corporation
* and others. All Rights Reserved. * and others. All Rights Reserved.
***************************************************************** *****************************************************************
* Date Name Description * Date Name Description
@ -177,7 +177,7 @@ class AnyTransliterator extends Transliterator {
} }
} }
Integer key = new Integer(source); Integer key = Integer.valueOf(source);
Transliterator t = cache.get(key); Transliterator t = cache.get(key);
if (t == null) { if (t == null) {
String sourceName = UScript.getName(source); String sourceName = UScript.getName(source);

View File

@ -1245,7 +1245,7 @@ public abstract class Transliterator implements StringTransform {
MessageFormat format = new MessageFormat( MessageFormat format = new MessageFormat(
bundle.getString(RB_DISPLAY_NAME_PATTERN)); bundle.getString(RB_DISPLAY_NAME_PATTERN));
// Construct the argument array // Construct the argument array
Object[] args = new Object[] { new Integer(2), stv[0], stv[1] }; Object[] args = new Object[] { Integer.valueOf(2), stv[0], stv[1] };
// Use display names for the scripts, if they exist // Use display names for the scripts, if they exist
for (int j=1; j<=2; ++j) { for (int j=1; j<=2; ++j) {