src/share/classes/javax/print/MimeType.java
Print this page
@@ -115,22 +115,22 @@
private transient ParameterMap myParameterMap = null;
/**
* Parameter map entry.
*/
- private class ParameterMapEntry implements Map.Entry {
+ private class ParameterMapEntry implements Map.Entry<String, String> {
private int myIndex;
public ParameterMapEntry(int theIndex) {
myIndex = theIndex;
}
- public Object getKey(){
+ public String getKey(){
return myPieces[myIndex];
}
- public Object getValue(){
+ public String getValue(){
return myPieces[myIndex+1];
}
- public Object setValue (Object value) {
+ public String setValue (String value) {
throw new UnsupportedOperationException();
}
public boolean equals(Object o) {
return (o != null &&
o instanceof Map.Entry &&
@@ -143,16 +143,16 @@
}
/**
* Parameter map entry set iterator.
*/
- private class ParameterMapEntrySetIterator implements Iterator {
+ private class ParameterMapEntrySetIterator implements Iterator<Map.Entry<String, String>> {
private int myIndex = 2;
public boolean hasNext() {
return myIndex < myPieces.length;
}
- public Object next() {
+ public Map.Entry<String, String> next() {
if (hasNext()) {
ParameterMapEntry result = new ParameterMapEntry (myIndex);
myIndex += 2;
return result;
} else {
@@ -165,24 +165,24 @@
}
/**
* Parameter map entry set.
*/
- private class ParameterMapEntrySet extends AbstractSet {
- public Iterator iterator() {
+ private class ParameterMapEntrySet extends AbstractSet<Map.Entry<String, String>> {
+ public Iterator<Map.Entry<String, String>> iterator() {
return new ParameterMapEntrySetIterator();
}
public int size() {
return (myPieces.length - 2) / 2;
}
}
/**
* Parameter map.
*/
- private class ParameterMap extends AbstractMap {
- public Set entrySet() {
+ private class ParameterMap extends AbstractMap<String, String> {
+ public Set<Map.Entry<String, String>> entrySet() {
if (myEntrySet == null) {
myEntrySet = new ParameterMapEntrySet();
}
return myEntrySet;
}
@@ -232,11 +232,11 @@
* name String (key) mapping to a parameter value String. If this MIME
* type object has no parameters, an empty map is returned.
*
* @return Parameter map for this MIME type object.
*/
- public Map getParameterMap() {
+ public Map<String, String> getParameterMap() {
if (myParameterMap == null) {
myParameterMap = new ParameterMap();
}
return myParameterMap;
}
@@ -546,11 +546,11 @@
if (s == null) {
throw new NullPointerException();
}
LexicalAnalyzer theLexer = new LexicalAnalyzer (s);
int theLexemeType;
- Vector thePieces = new Vector();
+ Vector<String> thePieces = new Vector<>();
boolean mediaTypeIsText = false;
boolean parameterNameIsCharset = false;
// Parse media type.
if (theLexer.getLexemeType() == TOKEN_LEXEME) {
@@ -621,11 +621,11 @@
throw new IllegalArgumentException();
}
// Save the pieces. Parameters are not in ascending order yet.
int n = thePieces.size();
- myPieces = (String[]) thePieces.toArray (new String [n]);
+ myPieces = thePieces.toArray (new String [n]);
// Sort the parameters into ascending order using an insertion sort.
int i, j;
String temp;
for (i = 4; i < n; i += 2) {