Created
August 1, 2021 02:56
-
-
Save rinotc/bcd386d9c5db7d09ba728c799c447669 to your computer and use it in GitHub Desktop.
Scala で case class を使った場合の、デフォルトパラメータが必要な時のBuilder Patternサンプル
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
case class NutritionFacts( | |
servingSize: Int, | |
servings: Int, | |
calories: Int = 0, | |
fat: Int = 0, | |
sodium: Int = 0, | |
carbohydrate: Int = 0 | |
) | |
val nf = NutritionFacts(1, 1, fat = 10) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment