@@ -16,8 +16,8 @@ In Java, one tends to see a lot of overloaded methods that only serve to provide
1616
1717 public class HashMap<K,V> {
1818 public HashMap(Map<? extends K,? extends V> m);
19- /** Create a new HashMap with default capacity (16)
20- * and loadFactor (0.75)
19+ /** Create a new HashMap with default capacity (16)
20+ * and loadFactor (0.75)
2121 */
2222 public HashMap();
2323 /** Create a new HashMap with default loadFactor (0.75) */
@@ -34,20 +34,20 @@ More problematic is that the values used for defaults are in both the Javadoc *a
3434 public static final float DEFAULT_LOAD_FACTOR = 0.75;
3535
3636 public HashMap(Map<? extends K,? extends V> m);
37- /** Create a new HashMap with default capacity (16)
38- * and loadFactor (0.75)
37+ /** Create a new HashMap with default capacity (16)
38+ * and loadFactor (0.75)
3939 */
4040 public HashMap();
4141 /** Create a new HashMap with default loadFactor (0.75) */
4242 public HashMap(int initialCapacity);
4343 public HashMap(int initialCapacity, float loadFactor);
4444 }
4545
46- While this keeps us from repeating ourselves, it's less than expressive.
46+ While this keeps us from repeating ourselves, it's less than expressive.
4747
4848Scala adds direct support for this:
4949
50- class HashMap[K,V](initialCapacity:Int = 16, loadFactor:Float = 0.75 ) {
50+ class HashMap[K,V](initialCapacity:Int = 16, loadFactor:Float = 0.75f ) {
5151 }
5252
5353 // Uses the defaults
@@ -57,11 +57,11 @@ Scala adds direct support for this:
5757 val m2= new HashMap[String,Int](20)
5858
5959 // overriding both
60- val m3 = new HashMap[String,Int](20,0.8 )
60+ val m3 = new HashMap[String,Int](20,0.8f )
6161
6262 // override only the loadFactory via
6363 // named arguments
64- val m4 = new HashMap[String,Int](loadFactor = 0.8 )
64+ val m4 = new HashMap[String,Int](loadFactor = 0.8f )
6565
6666Note how we can take advantage of * any* default value by using [ named parameters] ({{ site.baseurl }}/tutorials/tour/named-parameters.html).
6767
0 commit comments