< prev index next >
src/java.xml.ws/share/classes/com/sun/xml/internal/messaging/saaj/packaging/mime/internet/ParameterList.java
Print this page
@@ -1,7 +1,7 @@
/*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
@@ -42,20 +42,20 @@
* @author John Mani
*/
public final class ParameterList {
- private final HashMap list;
+ private final HashMap<String, String> list;
/**
* No-arg Constructor.
*/
public ParameterList() {
- this.list = new HashMap();
+ this.list = new HashMap<String, String>();
}
- private ParameterList(HashMap m) {
+ private ParameterList(HashMap<String, String> m) {
this.list = m;
}
/**
* Constructor that takes a parameter-list string. The String
@@ -71,11 +71,11 @@
HeaderTokenizer h = new HeaderTokenizer(s, HeaderTokenizer.MIME);
HeaderTokenizer.Token tk;
int type;
String name;
- list = new HashMap();
+ list = new HashMap<String, String>();
while (true) {
tk = h.next();
type = tk.getType();
if (type == HeaderTokenizer.Token.EOF) // done
@@ -128,11 +128,11 @@
* @return Value of the parameter. Returns
* <code>null</code> if the parameter is not
* present.
*/
public String get(String name) {
- return (String)list.get(name.trim().toLowerCase());
+ return list.get(name.trim().toLowerCase());
}
/**
* Set a parameter. If this parameter already exists, it is
* replaced by this new value.
@@ -158,11 +158,11 @@
* Return an enumeration of the names of all parameters in this
* list.
*
* @return Enumeration of all parameter names in this list.
*/
- public Iterator getNames() {
+ public Iterator<String> getNames() {
return list.keySet().iterator();
}
/**
@@ -188,17 +188,17 @@
* the field into which the parameter list is to
* be inserted.
* @return String
*/
public String toString(int used) {
- StringBuffer sb = new StringBuffer();
- Iterator itr = list.entrySet().iterator();
+ StringBuilder sb = new StringBuilder();
+ Iterator<Map.Entry<String, String>> itr = list.entrySet().iterator();
while (itr.hasNext()) {
- Map.Entry e = (Map.Entry)itr.next();
- String name = (String)e.getKey();
- String value = quote((String)e.getValue());
+ Map.Entry<String, String> e = itr.next();
+ String name = e.getKey();
+ String value = quote(e.getValue());
sb.append("; ");
used += 2;
int len = name.length() + value.length() + 1;
if (used + len > 76) { // overflows ...
sb.append("\r\n\t"); // .. start new continuation line
< prev index next >