Skip to content

Commit

Permalink
Generics.md: "Aproach" -> "Approach"
Browse files Browse the repository at this point in the history
  • Loading branch information
btj committed Aug 29, 2021
1 parent 43bea21 commit df4157a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion generics.md
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ Note also that with this approach, we lose much of the benefit of Java's static
- Iterating over `staffMembers` instead of `students` in method `getNbFinishers`. This would lead to a `ClassCastException` in `getNbFinishers()`, except if `staffMembers` is empty. In the latter case, it would silently produce wrong results.
- The corresponding errors in `addStaff`, `hasStaff`, and `getAvgNbPubs`.

### Aproach 3: Generics
### Approach 3: Generics

We can achieve reuse without sacrificing static type checking by defining types `Iterator`, `Iterable`, and `LinkedList` as _generic types_ with a _type parameter_ `T`:
```java
Expand Down

0 comments on commit df4157a

Please sign in to comment.