1308 |
|
} |
1309 |
|
|
1310 |
|
public boolean isEmpty() { |
1311 |
< |
return entrySet.isEmpty(); |
1311 |
> |
return entrySet().isEmpty(); |
1312 |
|
} |
1313 |
|
|
1314 |
|
public boolean containsKey(Object key) { |
1372 |
|
public Map.Entry<K,V> pollFirstEntry() { |
1373 |
|
TreeMap.Entry<K,V> e = fromStart ? |
1374 |
|
getFirstEntry() : getCeilingEntry(fromKey); |
1375 |
< |
if (e == null || (!fromStart && compare(e.key, fromKey) < 0)) |
1375 |
> |
if (e == null || (!toEnd && compare(e.key, toKey) >= 0)) |
1376 |
|
return null; |
1377 |
|
Map.Entry result = new AbstractMap.SimpleImmutableEntry(e); |
1378 |
|
deleteEntry(e); |
1382 |
|
public Map.Entry<K,V> pollLastEntry() { |
1383 |
|
TreeMap.Entry<K,V> e = toEnd ? |
1384 |
|
getLastEntry() : getLowerEntry(toKey); |
1385 |
< |
if (e == null || (!toEnd && compare(e.key, toKey) >= 0)) |
1385 |
> |
if (e == null || (!fromStart && compare(e.key, fromKey) < 0)) |
1386 |
|
return null; |
1387 |
|
Map.Entry result = new AbstractMap.SimpleImmutableEntry(e); |
1388 |
|
deleteEntry(e); |
1462 |
|
return e == null? null : e.key; |
1463 |
|
} |
1464 |
|
|
1465 |
< |
private transient Set<Map.Entry<K,V>> entrySet = new EntrySetView(); |
1465 |
> |
private transient Set<Map.Entry<K,V>> entrySet = null; |
1466 |
|
|
1467 |
|
public Set<Map.Entry<K,V>> entrySet() { |
1468 |
< |
return entrySet; |
1468 |
> |
Set<Map.Entry<K,V>> es = entrySet; |
1469 |
> |
return (es != null)? es : (entrySet = new EntrySetView()); |
1470 |
|
} |
1471 |
|
|
1472 |
|
private class EntrySetView extends AbstractSet<Map.Entry<K,V>> { |
2163 |
|
// Write out size (number of Mappings) |
2164 |
|
s.writeInt(size); |
2165 |
|
|
2166 |
+ |
Set<Map.Entry<K,V>> es = entrySet(); |
2167 |
|
// Write out keys and values (alternating) |
2168 |
< |
for (Iterator<Map.Entry<K,V>> i = entrySet().iterator(); i.hasNext(); ) { |
2168 |
> |
for (Iterator<Map.Entry<K,V>> i = es.iterator(); i.hasNext(); ) { |
2169 |
|
Map.Entry<K,V> e = i.next(); |
2170 |
|
s.writeObject(e.getKey()); |
2171 |
|
s.writeObject(e.getValue()); |