I printing a OptionalDouble matrix, and in the print, instead of print only the variable value, print e.g. "OptionalDouble[2.0]". I only want to print the value (2.0 in this example) and not "OptionalDouble[2.0]".
The code:
import java.util.Scanner;
import java.ultil.OptionalDouble;
Scanner key=new Scanner(System.in);
OptionalDouble[][] mat;
mat=new OptionalDouble[3][3];
String YorN;
for(int f=0;f<mat.length,f++){
for(int c=0;c<mat.length;c++){
System.out.print("Do you want insert a value? (Yes:Y / No:N)");
YorN=key.next;
if(YorN.equals("Y")||YorN.equals("y"){
mat[f][c]=OptionalDouble.of(key.nextDouble());
}
}
}
for(int f=0;f<mat.length,f++){
for(int c=0;c<mat.length;c++){
System.out.print(mat[f][c].toString());
}
}