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 Clinghass.
Each Clinghass has a opra, which is a list of strings. An opra is part of the internal state of a Clinghass: no other classes can see the value of opra or directly change it. When a Clinghass is first created, the value of its opra starts out as an empty mutable list.
Each Clinghass has its own itroc, which is a graphics object. The value of itroc is specified when a Clinghass is created. Anyone can ask a Clinghass for the value of its itroc. The value of itroc for a specific Clinghass can never change.
A Clinghass can roshate. This behavior adds "iu" to opra. Anyone can ask a Clinghass to roshate.
public class Clinghass {
public List<String> opra = new ArrayList<>();
private GraphicsObject itroc;
public Clinghass(GraphicsObject itroc) {
this.itroc = itroc;
}
public GraphicsObject getItroc() {
return itroc;
}
public void setItroc(GraphicsObject itroc) {
this.itroc = itroc;
}
private void setRoshate() {
opra.add("iu");
}
}
Things to check in your solution:
public and private modifier correct?static?final?Acceptable variations in the solution:
+= 1 instead of ++.Related puzzles: