ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/jsr166/jsr166/src/main/java/util/concurrent/ConcurrentSkipListMap.java
(Generate patch)

Comparing jsr166/src/main/java/util/concurrent/ConcurrentSkipListMap.java (file contents):
Revision 1.52 by jsr166, Tue May 9 16:34:44 2006 UTC vs.
Revision 1.53 by jsr166, Thu Jun 8 08:27:40 2006 UTC

# Line 1385 | Line 1385 | public class ConcurrentSkipListMap<K,V>
1385          }
1386      }
1387  
1388 +
1389      /* ---------------- Constructors -------------- */
1390  
1391      /**
# Line 2303 | Line 2304 | public class ConcurrentSkipListMap<K,V>
2304       * needing type-tests for Iterator methods.
2305       */
2306  
2307 +    static final <E> List<E> toList(Collection<E> c) {
2308 +        // Using size() here would be a pessimization.
2309 +        List<E> list = new ArrayList<E>();
2310 +        for (E e : c)
2311 +            list.add(e);
2312 +        return list;
2313 +    }
2314 +
2315      static final class KeySet<E> extends AbstractSet<E> implements NavigableSet<E> {
2316          private final ConcurrentNavigableMap<E,Object> m;
2317          KeySet(ConcurrentNavigableMap<E,Object> map) { m = map; }
# Line 2346 | Line 2355 | public class ConcurrentSkipListMap<K,V>
2355                  return false;
2356              }
2357          }
2358 +        public Object[] toArray()     { return toList(this).toArray();  }
2359 +        public <T> T[] toArray(T[] a) { return toList(this).toArray(a); }
2360          public Iterator<E> descendingIterator() {
2361              return descendingSet().iterator();
2362          }
# Line 2400 | Line 2411 | public class ConcurrentSkipListMap<K,V>
2411          public void clear() {
2412              m.clear();
2413          }
2414 +        public Object[] toArray()     { return toList(this).toArray();  }
2415 +        public <T> T[] toArray(T[] a) { return toList(this).toArray(a); }
2416      }
2417  
2418      static final class EntrySet<K1,V1> extends AbstractSet<Map.Entry<K1,V1>> {
# Line 2452 | Line 2465 | public class ConcurrentSkipListMap<K,V>
2465                  return false;
2466              }
2467          }
2468 +        public Object[] toArray()     { return toList(this).toArray();  }
2469 +        public <T> T[] toArray(T[] a) { return toList(this).toArray(a); }
2470      }
2471  
2472      /**

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines