Another possibility is a hash map using "<origin>|<destinationn>" as a key with the distance as a value.
In that case they are not Strings. If they are doubles, use them as doubles, or in this situation, probably as Doubles.
Marin Capranov wrote:. . . distances extracted from distance matrix API. They can be parsed to double,
It may look as if Carey and I were being very fussy, but we know it is necessary to have your ideas clear before you try any coding.
. . . . I thought to make it as a matrix. . . . .
I need the distances for the genetic algorithm to find the shortest route