I have a tree with nodes which are named by their coordinates. I just bunched these two separate coordinates up into a single String[] coordinates like so
class Node {
private String[] coordinates;
public Node(){
coordinates = new String[2];
}
public setCoordinates(String[] coordinates){
this.coordinates = coordinates;
}
I'm sure the solution must be simple. Assume I don't want a special setter which takes two strings and sets them individually, coordinates[0] = X, coordinates[1] = Y. That's pretty obvious. How could I pass an array of Strings to the fixed-length setter?
I tried
setCoordinates({"-44.55", "55.22"});
and
setCoordinates(["-44.55", "55.22"});
also tried passing new String[2] = {} and with [], but those don't work either.