summaryrefslogtreecommitdiff
path: root/java/text/SimpleDateFormat.java
diff options
context:
space:
mode:
authorAndrew John Hughes <gnu_andrew@member.fsf.org>2008-12-31 08:27:23 +0000
committerAndrew John Hughes <gnu_andrew@member.fsf.org>2008-12-31 08:27:23 +0000
commit72722486ae49ce3e6c4eda755e0ad7066e16db93 (patch)
tree8b85eaa5508060a03e2700f9e78e719362874e62 /java/text/SimpleDateFormat.java
parent95477f623ca280124208a419d55124fe345fc843 (diff)
downloadclasspath-72722486ae49ce3e6c4eda755e0ad7066e16db93.tar.gz
Cleanup of java.text classes.
2008-12-31 Andrew John Hughes <gnu_andrew@member.fsf.org> * java/text/MessageFormat.java: Convert variables to use generic types, use CPStringBuilder in place of StringBuilder. (Field()): Suppress warning due to only being used by deserialization. (scanFormat(String,int,CPStringBuilder,List,Locale)): Use ArrayList instead of Vector as no synchronisation needed. (parse(String,ParsePosition)): Likewise. * java/text/NumberFormat.java: (Field()): Suppress warning due to only being used by deserialization. * java/text/RuleBasedCollator.java: Convert variables to use generic types. (CollationElement): Make fields final. (CollationSorter): Likewise. (CollationSorter(int,String,int,boolean)): New constructor. * java/text/SimpleDateFormat.java, Convert variables to use generic types. (applyPattern(String)): Clear list rather than creating a new instance.
Diffstat (limited to 'java/text/SimpleDateFormat.java')
-rw-r--r--java/text/SimpleDateFormat.java18
1 files changed, 8 insertions, 10 deletions
diff --git a/java/text/SimpleDateFormat.java b/java/text/SimpleDateFormat.java
index 7d57f67a0..cea599b82 100644
--- a/java/text/SimpleDateFormat.java
+++ b/java/text/SimpleDateFormat.java
@@ -159,13 +159,13 @@ public class SimpleDateFormat extends DateFormat
}
/**
- * A list of <code>CompiledField</code>s,
+ * A list of <code>CompiledField</code>s and {@code String}s
* representing the compiled version of the pattern.
*
* @see CompiledField
* @serial Ignored.
*/
- private transient ArrayList tokens;
+ private transient ArrayList<Object> tokens;
/**
* The localised data used in formatting,
@@ -274,7 +274,7 @@ public class SimpleDateFormat extends DateFormat
set2DigitYearStart(defaultCenturyStart);
// Set up items normally taken care of by the constructor.
- tokens = new ArrayList();
+ tokens = new ArrayList<Object>();
try
{
compileFormat(pattern);
@@ -416,7 +416,7 @@ public class SimpleDateFormat extends DateFormat
Locale locale = Locale.getDefault();
calendar = new GregorianCalendar(locale);
computeCenturyStart();
- tokens = new ArrayList();
+ tokens = new ArrayList<Object>();
formatData = new DateFormatSymbols(locale);
pattern = (formatData.dateFormats[DEFAULT] + ' '
+ formatData.timeFormats[DEFAULT]);
@@ -454,7 +454,7 @@ public class SimpleDateFormat extends DateFormat
super();
calendar = new GregorianCalendar(locale);
computeCenturyStart();
- tokens = new ArrayList();
+ tokens = new ArrayList<Object>();
formatData = new DateFormatSymbols(locale);
compileFormat(pattern);
this.pattern = pattern;
@@ -479,7 +479,7 @@ public class SimpleDateFormat extends DateFormat
super();
calendar = new GregorianCalendar();
computeCenturyStart ();
- tokens = new ArrayList();
+ tokens = new ArrayList<Object>();
if (formatData == null)
throw new NullPointerException("formatData");
this.formatData = formatData;
@@ -524,7 +524,7 @@ public class SimpleDateFormat extends DateFormat
*/
public void applyPattern(String pattern)
{
- tokens = new ArrayList();
+ tokens.clear();
compileFormat(pattern);
this.pattern = pattern;
}
@@ -698,11 +698,10 @@ public class SimpleDateFormat extends DateFormat
private void formatWithAttribute(Date date, FormatBuffer buffer, FieldPosition pos)
{
String temp;
- AttributedCharacterIterator.Attribute attribute;
calendar.setTime(date);
// go through vector, filling in fields where applicable, else toString
- Iterator iter = tokens.iterator();
+ Iterator<Object> iter = tokens.iterator();
while (iter.hasNext())
{
Object o = iter.next();
@@ -911,7 +910,6 @@ public class SimpleDateFormat extends DateFormat
char ch = pattern.charAt(fmt_index);
if (ch == '\'')
{
- int index = pos.getIndex();
if (fmt_index < fmt_max - 1
&& pattern.charAt(fmt_index + 1) == '\'')
{