chore: organize homework into first-part directory
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
import java.util.Objects;
|
||||
|
||||
final class ImmutableClass {
|
||||
ImmutableClass(MutableClass firstField, String secondField, Integer thirdField) {
|
||||
this.firstField = new MutableClass(Objects.requireNonNull(firstField));
|
||||
this.secondField = secondField;
|
||||
this.thirdField = thirdField;
|
||||
}
|
||||
|
||||
public MutableClass getFirstField() {
|
||||
return new MutableClass(firstField);
|
||||
}
|
||||
|
||||
public String getSecondField() {
|
||||
// Копировать не нужно так как String является Immutable
|
||||
return secondField;
|
||||
}
|
||||
|
||||
public Integer getThirdField() {
|
||||
// Копировать не нужно так как Integer является Immutable
|
||||
return thirdField;
|
||||
}
|
||||
|
||||
private final MutableClass firstField;
|
||||
private final String secondField;
|
||||
private final Integer thirdField;
|
||||
}
|
||||
Reference in New Issue
Block a user