src/share/classes/java/util/TreeMap.java

Print this page

        

@@ -1054,15 +1054,15 @@
         public E first() { return m.firstKey(); }
         public E last() { return m.lastKey(); }
         public Comparator<? super E> comparator() { return m.comparator(); }
         public E pollFirst() {
             Map.Entry<E,Object> e = m.pollFirstEntry();
-            return e == null? null : e.getKey();
+            return (e == null) ? null : e.getKey();
         }
         public E pollLast() {
             Map.Entry<E,Object> e = m.pollLastEntry();
-            return e == null? null : e.getKey();
+            return (e == null) ? null : e.getKey();
         }
         public boolean remove(Object o) {
             int oldSize = size();
             m.remove(o);
             return size() != oldSize;

@@ -1194,27 +1194,27 @@
 
     /**
      * Test two values for equality.  Differs from o1.equals(o2) only in
      * that it copes with {@code null} o1 properly.
      */
-    final static boolean valEquals(Object o1, Object o2) {
+    static final boolean valEquals(Object o1, Object o2) {
         return (o1==null ? o2==null : o1.equals(o2));
     }
 
     /**
      * Return SimpleImmutableEntry for entry, or null if null
      */
     static <K,V> Map.Entry<K,V> exportEntry(TreeMap.Entry<K,V> e) {
-        return e == null? null :
+        return (e == null) ? null :
             new AbstractMap.SimpleImmutableEntry<K,V>(e);
     }
 
     /**
      * Return key for entry, or null if null
      */
     static <K,V> K keyOrNull(TreeMap.Entry<K,V> e) {
-        return e == null? null : e.key;
+        return (e == null) ? null : e.key;
     }
 
     /**
      * Returns the key corresponding to the specified Entry.
      * @throws NoSuchElementException if the Entry is null

@@ -1235,11 +1235,11 @@
     private static final Object UNBOUNDED = new Object();
 
     /**
      * @serial include
      */
-    static abstract class NavigableSubMap<K,V> extends AbstractMap<K,V>
+    abstract static class NavigableSubMap<K,V> extends AbstractMap<K,V>
         implements NavigableMap<K,V>, java.io.Serializable {
         /**
          * The backing map.
          */
         final TreeMap<K,V> m;

@@ -1410,15 +1410,15 @@
                 throw new IllegalArgumentException("key out of range");
             return m.put(key, value);
         }
 
         public final V get(Object key) {
-            return !inRange(key)? null :  m.get(key);
+            return !inRange(key) ? null :  m.get(key);
         }
 
         public final V remove(Object key) {
-            return !inRange(key)? null  : m.remove(key);
+            return !inRange(key) ? null : m.remove(key);
         }
 
         public final Map.Entry<K,V> ceilingEntry(K key) {
             return exportEntry(subCeiling(key));
         }

@@ -1557,11 +1557,12 @@
                 Map.Entry<K,V> entry = (Map.Entry<K,V>) o;
                 K key = entry.getKey();
                 if (!inRange(key))
                     return false;
                 TreeMap.Entry<K,V> node = m.getEntry(key);
-                if (node!=null && valEquals(node.getValue(),entry.getValue())){
+                if (node!=null && valEquals(node.getValue(),
+                                            entry.getValue())) {
                     m.deleteEntry(node);
                     return true;
                 }
                 return false;
             }

@@ -1722,11 +1723,11 @@
             return new AscendingSubMap(m,
                                        fromStart, lo,    loInclusive,
                                        false,     toKey, inclusive);
         }
 
-        public NavigableMap<K,V> tailMap(K fromKey, boolean inclusive){
+        public NavigableMap<K,V> tailMap(K fromKey, boolean inclusive) {
             if (!inRange(fromKey, inclusive))
                 throw new IllegalArgumentException("fromKey out of range");
             return new AscendingSubMap(m,
                                        false, fromKey, inclusive,
                                        toEnd, hi,      hiInclusive);

@@ -1803,11 +1804,11 @@
             return new DescendingSubMap(m,
                                         false, toKey, inclusive,
                                         toEnd, hi,    hiInclusive);
         }
 
-        public NavigableMap<K,V> tailMap(K fromKey, boolean inclusive){
+        public NavigableMap<K,V> tailMap(K fromKey, boolean inclusive) {
             if (!inRange(fromKey, inclusive))
                 throw new IllegalArgumentException("fromKey out of range");
             return new DescendingSubMap(m,
                                         fromStart, lo, loInclusive,
                                         false, fromKey, inclusive);

@@ -2141,11 +2142,11 @@
         size--;
 
         // If strictly internal, copy successor's element to p and then make p
         // point to successor.
         if (p.left != null && p.right != null) {
-            Entry<K,V> s = successor (p);
+            Entry<K,V> s = successor(p);
             p.key = s.key;
             p.value = s.value;
             p = s;
         } // p has 2 children