Skip to content

Commit

Permalink
fix: Update newline tag on singleton pattern post
Browse files Browse the repository at this point in the history
  • Loading branch information
milkcoke committed Mar 8, 2024
1 parent 8ea8cf0 commit b065b3b
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions docs/design-pattern/01-create-pattern/01-singleton-pattern.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,12 +74,12 @@ And does not support 'inheritance' from other class. \
Enum already inherits from Enum class in `java.lang.Enum.java`.

# Summary
| Approach | Pros | Cons |
|-----------------------|----------------------------------------------|---------------------------------------------------------|
| Naive | Simple | Not thread-safe, Eager Loading |
| Static factory method | Thread-safe | Eager Loading |
| BillPugh | Relative simple\ Thread-safe\ Lazy Loading | |
| Enum | Best simple\Thread-safe \ Prevent reflection | Eager Loading \ Unable to inheritance from other class |
| Approach | Pros | Cons |
|-----------------------|-------------------------------------------------------------|-----------------------------------------------------------------|
| Naive | Simple | Not thread-safe, Eager Loading |
| Static factory method | Thread-safe | Eager Loading |
| BillPugh | Relative simple<br></br> Thread-safe <br></br> Lazy Loading | |
| Enum | Best simple<br></br>Thread-safe<br></br> Prevent reflection | Eager Loading <br></br> Unable to inheritance from other class |


> **Use BillPugh approach when you have to lazy load or required to inheritance** \
Expand Down

0 comments on commit b065b3b

Please sign in to comment.