SHOW:
|
|
- or go back to the newest paste.
| 1 | - | public class ImmutableObject { |
| 1 | + | public class ImmutableObject {
|
| 2 | - | |
| 2 | + | |
| 3 | - | private final String string; |
| 3 | + | private final String string; |
| 4 | - | private final Date date; |
| 4 | + | private final Date date; |
| 5 | - | |
| 5 | + | |
| 6 | - | public ImmutableObject(String string, Date date) { |
| 6 | + | public ImmutableObject(String string, Date date) {
|
| 7 | - | this.string = string; |
| 7 | + | this.string = string; |
| 8 | - | this.date = date; |
| 8 | + | this.date = date; |
| 9 | - | } |
| 9 | + | } |
| 10 | - | |
| 10 | + | |
| 11 | - | public Date getDate() { |
| 11 | + | public Date getDate() {
|
| 12 | - | return new Date(date.getTime()); |
| 12 | + | return new Date(date.getTime()); |
| 13 | - | } |
| 13 | + | } |
| 14 | - | |
| 14 | + | |
| 15 | - | public String getString() { |
| 15 | + | public String getString() {
|
| 16 | - | return string; |
| 16 | + | return string; |
| 17 | - | } |
| 17 | + | } |
| 18 | - | |
| 18 | + | |
| 19 | } |