Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Scala で case class を使った場合の、デフォルトパラメータが必要な時のBuilder Patternサンプル
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