Changeset 1528:5c50b86bf1dd
- Timestamp:
- 10/15/10 21:53:11 (3 years ago)
- Author:
- tom
- Branch:
- default
- Message:
-
~ new implementation of keys() without cast check warning
- Files:
-
Legend:
- Unmodified
- Added
- Removed
-
|
r1337
|
r1528
|
|
| 4 | 4 | package org.w3c.unicorn.util; |
| 5 | 5 | |
| 6 | | import java.util.Collections; |
| 7 | 6 | import java.util.Enumeration; |
| | 7 | import java.util.Iterator; |
| 8 | 8 | import java.util.Properties; |
| 9 | 9 | import java.util.Set; |
| 10 | 10 | import java.util.TreeSet; |
| 11 | | import java.util.Vector; |
| 12 | 11 | import java.util.regex.Matcher; |
| 13 | 12 | import java.util.regex.Pattern; |
| … |
… |
|
| 57 | 56 | } |
| 58 | 57 | |
| 59 | | @SuppressWarnings("unchecked") |
| 60 | | public Enumeration keys() { |
| 61 | | Enumeration keysEnum = super.keys(); |
| 62 | | Vector<String> keyList = new Vector<String>(); |
| 63 | | while(keysEnum.hasMoreElements()) |
| 64 | | keyList.add((String)keysEnum.nextElement()); |
| 65 | | Collections.sort(keyList); |
| 66 | | return keyList.elements(); |
| | 58 | public Enumeration<Object> keys() { |
| | 59 | final Iterator<Object> i = this.keySet().iterator(); |
| | 60 | return new Enumeration<Object>() { |
| | 61 | @Override |
| | 62 | public boolean hasMoreElements() { |
| | 63 | return i.hasNext(); |
| | 64 | } |
| | 65 | @Override |
| | 66 | public Object nextElement() { |
| | 67 | return i.next(); |
| | 68 | } |
| | 69 | }; |
| 67 | 70 | } |
| 68 | 71 | |