Refactors using var

This commit is contained in:
Anurag Agarwal
2020-08-04 21:46:30 +00:00
parent 4b38746ce9
commit a7095602d6
3 changed files with 16 additions and 16 deletions

View File

@ -70,22 +70,18 @@ public class Star {
}
StarMemento getMemento() {
var state = new StarMementoInternal();
state.setAgeYears(ageYears);
state.setMassTons(massTons);
state.setType(type);
return state;
}
void setMemento(StarMemento memento) {
var state = (StarMementoInternal) memento;
this.type = state.getType();
this.ageYears = state.getAgeYears();
this.massTons = state.getMassTons();
}
@Override

View File

@ -27,9 +27,12 @@ package com.iluwatar.memento;
* StarType enumeration.
*/
public enum StarType {
SUN("sun"), RED_GIANT("red giant"), WHITE_DWARF("white dwarf"), SUPERNOVA("supernova"), DEAD(
"dead star"), UNDEFINED("");
SUN("sun"),
RED_GIANT("red giant"),
WHITE_DWARF("white dwarf"),
SUPERNOVA("supernova"),
DEAD("dead star"),
UNDEFINED("");
private final String title;