Skip to content

Commit 492fb9f

Browse files
authored
Miscellaneous fixes (#84)
* Fix typos/grammar * Fix code example * Fix typo * Fix typo * Fix typo * Fix grammar * Fix grammar * Fix typo * Fix typo * Fix typo
1 parent 50271bf commit 492fb9f

16 files changed

+23
-23
lines changed

src/collections/factories.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ class Main {
6262
}
6363
```
6464

65-
If you want the opposite - if you want to make a copy of a something like an `ArrayList`
65+
If you want the opposite - if you want to make a copy of something like an `ArrayList`
6666
which does not support `.add`, `.remove`, etc. - you can use `copyOf`.
6767

6868
```java

src/encapsulation/classes.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ public class ArrayList<E> extends AbstractList<E>
5252
}
5353
```
5454

55-
People who write programs that depend on the calling `.add` on an `ArrayList` do not need
55+
People who write programs that depend on calling `.add` on an `ArrayList` do not need
5656
to understand how or when the internal `elementData` and `size` fields are updated. Those also
5757
need not be the only fields that exist. All that is required is "calling `.add` will add an element to the list."
5858

src/encapsulation/coupling.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,5 @@ long as code that is coupled is also "co-located" making changes
1414
to that code can be easier than if it were spread over multiple files.
1515

1616
A not insignificant part of practice in the coding world is deciding when
17-
pieces of a program deserve to be abstracted from eachother (to minimize interdependence)
17+
pieces of a program deserve to be abstracted from each other (to minimize interdependence)
1818
and when they deserve to be coupled together (to keep logic in one place.)

src/hash_maps/appropriate_keys.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
Both objects with reference based and value based definitions of `equals` and `hashCode`
44
are "appropriate" to use as keys in `HashMap`s.
55

6-
The most important thing to be careful of using objects where`equals` and `hashCode`
6+
The most important thing to be careful of is using objects where`equals` and `hashCode`
77
are value based, but the object itself is mutable.
88

99
```java

src/hash_maps/hash_distribution.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ If you open up a doctor's office in South Boston, you might have an issue
77
ordering charts by last name only. Your `M` cabinet will be overflowing.[^irish]
88

99
For that scenario, using the first letter of the last name is a non-ideal hash function
10-
because so when many people have last names starting with the same letter, they will
10+
because when so many people have last names starting with the same letter, they will
1111
not be evenly distributed amongst the buckets.
1212

1313
Making a hash function with a good distribution is hard. `Objects.hash` will do a decent job of it

src/hash_maps/reference_based_identity.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ Instead of making buckets like `A-G` and `H-Z`, it will use ranges of numbers. T
88
same though
99

1010
For classes you make yourself, their `hashCode` will be based on what we call an object's
11-
"identity." This means that while different instances of a class might give the same
11+
"identity." This means that while different instances of a class might give the same (incomplete sentence)
1212

1313

1414
```java
@@ -67,8 +67,8 @@ class Main {
6767
// Car C is a distinct object with its own identity
6868
var carC = new LivingRaceCar(10);
6969

70-
// Car C therefore only equal itself
71-
// Car A and B will equal eachother
70+
// Car C therefore will only equal itself
71+
// Car A and B will equal each other
7272
IO.println("A.equals(A): " + carA.equals(carA));
7373
IO.println("A.equals(B): " + carA.equals(carB));
7474
IO.println("A.equals(C): " + carA.equals(carC));

src/hash_maps/value_based_identity.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Value Based Identity
22

3-
While reference based identity can be useful, its often not what you want for keys in a `HashMap`.
4-
Ideally if you are looking up `"Tow Mater"` you shouldn't have to be careful to ensure its the *same*
3+
While reference based identity can be useful, it's often not what you want for keys in a `HashMap`.
4+
Ideally if you are looking up `"Tow Mater"` you shouldn't have to be careful to ensure it's the *same*
55
instance of `String`, all you care about is that it contains the right characters.
66

77
We call this notion of identity "value based." Two things are the same if they contain the same data - i.e. if they represent the same value.

src/hyrums_law/authority.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ are not really laws in the same way as "The Law of Conservation of Energy."
55

66
Those sorts of laws are observed truths about a field. Best we can tell they are always true, no matter what.
77

8-
Hyrum's Law is just an aphorism. Its one specific person's view on the field.
8+
Hyrum's Law is just an aphorism. It's one specific person's view on the field.
99

1010
This sounds sketchy, and it is, but the state
1111
of the computing field is such that aphorisms and personal anecdotes are often the best information we have.

src/hyrums_law/emergent_properties.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,5 @@ Hyrum's law is one of those sorts of things. Nobody sat down and agreed
77
that they will use an API in wacky ways. It just happens when you throw enough
88
monkeys in a pile and they all reach for a keyboard.
99

10-
As such, the way to deal with it isn't to put blame upon the monkeys. Its
10+
As such, the way to deal with it isn't to put blame upon the monkeys. It's
1111
to accept it as a naturally occurring phenominon and plan accordingly.

src/interfaces_ii.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,5 @@
33
Interfaces let you describe a common set of methods shared
44
by different implementing classes.
55

6-
They can do slightly more than this though and its helpful
6+
They can do slightly more than this though and it's helpful
77
to know about.

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy