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.45 by jsr166, Sun May 18 23:47:56 2008 UTC vs.
Revision 1.51 by jsr166, Mon Sep 27 19:15:15 2010 UTC

# Line 1 | Line 1
1   /*
2 < * Copyright 1997-2007 Sun Microsystems, Inc.  All Rights Reserved.
2 > * Copyright (c) 1997, 2008, Oracle and/or its affiliates. All rights reserved.
3   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4   *
5   * This code is free software; you can redistribute it and/or modify it
# Line 18 | Line 18
18   * 2 along with this work; if not, write to the Free Software Foundation,
19   * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20   *
21 < * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
22 < * CA 95054 USA or visit www.sun.com if you need additional information or
23 < * have any questions.
21 > * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 > * or visit www.oracle.com if you need additional information or have any
23 > * questions.
24   */
25  
26   package java.util;
# Line 93 | Line 93 | package java.util;
93   * @param <V> the type of mapped values
94   *
95   * @author  Josh Bloch and Doug Lea
96 * @version %I%, %G%
96   * @see Map
97   * @see HashMap
98   * @see Hashtable
# Line 1022 | Line 1021 | public class TreeMap<K,V>
1021      }
1022  
1023      Iterator<K> descendingKeyIterator() {
1024 <        return new DescendingKeyIterator(getFirstEntry());
1024 >        return new DescendingKeyIterator(getLastEntry());
1025      }
1026  
1027      static final class KeySet<E> extends AbstractSet<E> implements NavigableSet<E> {
# Line 1069 | Line 1068 | public class TreeMap<K,V>
1068          }
1069          public NavigableSet<E> subSet(E fromElement, boolean fromInclusive,
1070                                        E toElement,   boolean toInclusive) {
1071 <            return new TreeSet<E>(m.subMap(fromElement, fromInclusive,
1072 <                                           toElement,   toInclusive));
1071 >            return new KeySet<E>(m.subMap(fromElement, fromInclusive,
1072 >                                          toElement,   toInclusive));
1073          }
1074          public NavigableSet<E> headSet(E toElement, boolean inclusive) {
1075 <            return new TreeSet<E>(m.headMap(toElement, inclusive));
1075 >            return new KeySet<E>(m.headMap(toElement, inclusive));
1076          }
1077          public NavigableSet<E> tailSet(E fromElement, boolean inclusive) {
1078 <            return new TreeSet<E>(m.tailMap(fromElement, inclusive));
1078 >            return new KeySet<E>(m.tailMap(fromElement, inclusive));
1079          }
1080          public SortedSet<E> subSet(E fromElement, E toElement) {
1081              return subSet(fromElement, true, toElement, false);
# Line 1088 | Line 1087 | public class TreeMap<K,V>
1087              return tailSet(fromElement, true);
1088          }
1089          public NavigableSet<E> descendingSet() {
1090 <            return new TreeSet(m.descendingMap());
1090 >            return new KeySet(m.descendingMap());
1091          }
1092      }
1093  
# Line 1196 | Line 1195 | public class TreeMap<K,V>
1195       * Test two values for equality.  Differs from o1.equals(o2) only in
1196       * that it copes with <tt>null</tt> o1 properly.
1197       */
1198 <    final static boolean valEquals(Object o1, Object o2) {
1198 >    static final boolean valEquals(Object o1, Object o2) {
1199          return (o1==null ? o2==null : o1.equals(o2));
1200      }
1201  
# Line 1237 | Line 1236 | public class TreeMap<K,V>
1236      /**
1237       * @serial include
1238       */
1239 <    static abstract class NavigableSubMap<K,V> extends AbstractMap<K,V>
1239 >    abstract static class NavigableSubMap<K,V> extends AbstractMap<K,V>
1240          implements NavigableMap<K,V>, java.io.Serializable {
1241          /**
1242           * The backing map.
# Line 2143 | Line 2142 | public class TreeMap<K,V>
2142          // If strictly internal, copy successor's element to p and then make p
2143          // point to successor.
2144          if (p.left != null && p.right != null) {
2145 <            Entry<K,V> s = successor (p);
2145 >            Entry<K,V> s = successor(p);
2146              p.key = s.key;
2147              p.value = s.value;
2148              p = s;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines