Skip to content

Commit

Permalink
Compares records with data classes
Browse files Browse the repository at this point in the history
  • Loading branch information
jesperancinha committed Feb 3, 2024
1 parent 9fa7d79 commit ff65c82
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
package org.jesperancinha.ktd.crums1.records;

public record VinylJava(String title, Long year) {}
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package org.jesperancinha.ktd.crums1

import org.jesperancinha.ktd.crums1.bertnernie.BertAndErnieLauncher
import org.jesperancinha.ktd.crums1.crum10.CrumTen
import org.jesperancinha.ktd.crums1.crum11.CrumEleven
import org.jesperancinha.ktd.crums1.crum12.CrumTwelve
Expand All @@ -18,6 +19,7 @@ import org.jesperancinha.ktd.crums1.crum6.CrumSix
import org.jesperancinha.ktd.crums1.crum7.CrumSeven
import org.jesperancinha.ktd.crums1.crum8.CrumEight
import org.jesperancinha.ktd.crums1.crum9.CrumNine
import org.jesperancinha.ktd.crums1.records.VinylLauncher

fun main(args: Array<String>) {
PrintToTheConsole()
Expand Down Expand Up @@ -62,5 +64,7 @@ fun main(args: Array<String>) {
CrumTwenty.main(args)

NumbersConversion.main()
BertAndErnieLauncher.main()
VinylLauncher.main()
}

Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package org.jesperancinha.ktd.crums1.bertnernie
class BertAndErnieLauncher {
companion object {
@JvmStatic
fun main(args: Array<String>) {
fun main(args: Array<String> = emptyArray()) {
println(ImmutableBertAndErnieJava().helloBertAndErnie())
println(ImmutableBertAndErnieJava().helloBertAndErnieClean())
println(ImmutableBertAndErnie().helloBertAndErnie())
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
package org.jesperancinha.ktd.crums1.records

data class Vinyl(val title: String, val year: Long)
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package org.jesperancinha.ktd.crums1.records

class VinylLauncher {
companion object{
@JvmStatic
fun main(args: Array<String> = emptyArray()) {
println(VinylJava("The mountain -> Why does a record need an empty body?", 1923))
println(Vinyl("The mountain -> Data classes don't need an empty body and they do the same thing!", 1923))
}
}
}

0 comments on commit ff65c82

Please sign in to comment.