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

Comparing jsr166/src/main/java/util/TreeMap.java (file contents):
Revision 1.35 by jsr166, Tue May 2 19:42:46 2006 UTC vs.
Revision 1.36 by jsr166, Tue May 9 16:35:40 2006 UTC

# Line 1050 | Line 1050 | public class TreeMap<K,V>
1050              return size() != oldSize;
1051          }
1052          public NavigableSet<E> subSet(E fromElement, boolean fromInclusive,
1053 <                                      E toElement, boolean toInclusive) {
1053 >                                      E toElement,   boolean toInclusive) {
1054              return new TreeSet<E>(m.subMap(fromElement, fromInclusive,
1055                                             toElement,   toInclusive));
1056          }
# Line 1207 | Line 1207 | public class TreeMap<K,V>
1207  
1208      // SubMaps
1209  
1210 +    /**
1211 +     * @serial include
1212 +     */
1213      static abstract class NavigableSubMap<K,V> extends AbstractMap<K,V>
1214          implements NavigableMap<K,V>, java.io.Serializable {
1215 <        /*
1215 >        /**
1216           * The backing map.
1217           */
1218          final TreeMap<K,V> m;
1219  
1220 <        /*
1220 >        /**
1221           * Endpoints are represented as triples (fromStart, lo,
1222           * loInclusive) and (toEnd, hi, hiInclusive). If fromStart is
1223           * true, then the low (absolute) bound is the start of the
# Line 1222 | Line 1225 | public class TreeMap<K,V>
1225           * if loInclusive is true, lo is the inclusive bound, else lo
1226           * is the exclusive bound. Similarly for the upper bound.
1227           */
1225
1228          final K lo, hi;
1229          final boolean fromStart, toEnd;
1230          final boolean loInclusive, hiInclusive;
# Line 1347 | Line 1349 | public class TreeMap<K,V>
1349          }
1350  
1351          // Abstract methods defined in ascending vs descending classes
1352 <        // These relay to the appropriate  absolute versions
1352 >        // These relay to the appropriate absolute versions
1353  
1354          abstract TreeMap.Entry<K,V> subLowest();
1355          abstract TreeMap.Entry<K,V> subHighest();
# Line 1634 | Line 1636 | public class TreeMap<K,V>
1636          }
1637      }
1638  
1639 +    /**
1640 +     * @serial include
1641 +     */
1642      static final class AscendingSubMap<K,V> extends NavigableSubMap<K,V> {
1643          private static final long serialVersionUID = 912986545866124060L;
1644  
1645          AscendingSubMap(TreeMap<K,V> m,
1646                          boolean fromStart, K lo, boolean loInclusive,
1647 <                        boolean toEnd, K hi, boolean hiInclusive) {
1647 >                        boolean toEnd,     K hi, boolean hiInclusive) {
1648              super(m, fromStart, lo, loInclusive, toEnd, hi, hiInclusive);
1649          }
1650  
# Line 1648 | Line 1653 | public class TreeMap<K,V>
1653          }
1654  
1655          public NavigableMap<K,V> subMap(K fromKey, boolean fromInclusive,
1656 <                                        K toKey, boolean toInclusive) {
1656 >                                        K toKey,   boolean toInclusive) {
1657              if (!inRange(fromKey, fromInclusive))
1658                  throw new IllegalArgumentException("fromKey out of range");
1659              if (!inRange(toKey, toInclusive))
# Line 1710 | Line 1715 | public class TreeMap<K,V>
1715          TreeMap.Entry<K,V> subLower(K key)   { return absLower(key); }
1716      }
1717  
1718 +    /**
1719 +     * @serial include
1720 +     */
1721      static final class DescendingSubMap<K,V>  extends NavigableSubMap<K,V> {
1722          private static final long serialVersionUID = 912986545866120460L;
1723          DescendingSubMap(TreeMap<K,V> m,
1724                          boolean fromStart, K lo, boolean loInclusive,
1725 <                        boolean toEnd, K hi, boolean hiInclusive) {
1725 >                        boolean toEnd,     K hi, boolean hiInclusive) {
1726              super(m, fromStart, lo, loInclusive, toEnd, hi, hiInclusive);
1727          }
1728  
# Line 1726 | Line 1734 | public class TreeMap<K,V>
1734          }
1735  
1736          public NavigableMap<K,V> subMap(K fromKey, boolean fromInclusive,
1737 <                                        K toKey, boolean toInclusive) {
1737 >                                        K toKey,   boolean toInclusive) {
1738              if (!inRange(fromKey, fromInclusive))
1739                  throw new IllegalArgumentException("fromKey out of range");
1740              if (!inRange(toKey, toInclusive))
# Line 1794 | Line 1802 | public class TreeMap<K,V>
1802       * support NavigableMap.  It translates an old-version SubMap into
1803       * a new-version AscendingSubMap. This class is never otherwise
1804       * used.
1805 +     *
1806 +     * @serial include
1807       */
1808      private class SubMap extends AbstractMap<K,V>
1809          implements SortedMap<K,V>, java.io.Serializable {
# Line 1877 | Line 1887 | public class TreeMap<K,V>
1887          public boolean equals(Object o) {
1888              if (!(o instanceof Map.Entry))
1889                  return false;
1890 <            Map.Entry e = (Map.Entry)o;
1890 >            Map.Entry<?,?> e = (Map.Entry<?,?>)o;
1891  
1892              return valEquals(key,e.getKey()) && valEquals(value,e.getValue());
1893          }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines