Humty Humty - 1 month ago 6
Android Question

android.util.Pair<F, S> example in Android

I want to return a tuple of

double
data types. I am unable to create
Pair
. I have read the documentation but unable to make it.
I am doing as

private Pair myNums(double F, double S) {
Pair<F f, S s> p = Pair.create(F, S);
return p;
}


But it is saying


Unknown class F

Answer

F and S are the type. In your case is Double.

Pair<Double, Double> p = Pair.create(F, S);