Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
mutate custom record hashCode and toString
- Loading branch information
Henry Coles
committed
Aug 6, 2021
1 parent
81ffeec
commit 6a1ef3f
Showing
8 changed files
with
56 additions
and
5 deletions.
There are no files selected for viewing
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
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
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
Binary file added
BIN
+1.75 KB
...t-entry/src/test/resources/sampleClasses/records/RecordWithCustomHashCode_javac.class.bin
Binary file not shown.
Binary file added
BIN
+1.73 KB
...t-entry/src/test/resources/sampleClasses/records/RecordWithCustomToString_javac.class.bin
Binary file not shown.
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
10 changes: 10 additions & 0 deletions
10
samples/src/main/java/com/example/RecordWithCustomHashCode.java
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
package com.example; | ||
|
||
import java.util.List; | ||
|
||
public record RecordWithCustomHashCode(List<Integer> ints, String data) { | ||
@Override | ||
public int hashCode() { | ||
return 42; | ||
} | ||
} |
10 changes: 10 additions & 0 deletions
10
samples/src/main/java/com/example/RecordWithCustomToString.java
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
package com.example; | ||
|
||
import java.util.List; | ||
|
||
public record RecordWithCustomToString(List<Integer> ints, String data) { | ||
@Override | ||
public String toString() { | ||
return data; | ||
} | ||
} |