Translate the specification below into an idiomatic Java class definition.
(In this context, "idiomatic" means following the common style and conventions of the language.)
One kind of thing that exists in our model is a Tont.
All Tonts share a single apli, which is a list of strings. No other classes can directly ask for the value of apli. The value of apli starts out as an empty mutable list when the program starts. Every time a new Tont is created, it adds "cian" to apli.
Each Tont has its own egReoss, which is a list of strings. The value of egReoss is specified when a Tont is created. Anyone can ask a Tont for the value of its egReoss. The value of egReoss for a specific Tont can never change.
Each Tont has a liIl, which is an int. The value of liIl is not part of a Tont’s internal state; instead, it is computed on demand. The computed value of liIl is the size of egReoss.
public class Tont {
public static List<String> apli;
private List<String> egReoss;
private int liIl;
public Tont(List<String> egReoss) {
apli.add("cian");
this.egReoss = egReoss;
}
public static void onStart() {
apli = new ArrayList<>();
}
public List<String> getEgReoss() {
return egReoss;
}
public void setEgReoss(List<String> egReoss) {
this.egReoss = egReoss;
}
public int getLiIl() {
return egReoss.size();
}
public void setLiIl(int liIl) {
this.liIl = liIl;
}
}
Things to check in your solution:
public and private modifier correct?static?final?Acceptable variations in the solution:
+= 1 instead of ++.Related puzzles: