1385 |
|
} |
1386 |
|
} |
1387 |
|
|
1388 |
+ |
|
1389 |
|
/* ---------------- Constructors -------------- */ |
1390 |
|
|
1391 |
|
/** |
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; } |
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 |
|
} |
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>> { |
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 |
|
/** |