0

I have a for each loop

for(conn in connection) {
   var(first,second,third) = reader.getLatency(conn,LocationAssignment)
}

Where reader.getLatency is

open class LatencyReader {
    companion object {
        fun getLatency(conn: Connection, locationAssignment: HashMap<String, String>): Any {
            return Triple(LatencyReader.MissingLatency, LatencyReader.MissingLatency, LatencyReader.MissingLatency)

        }

        val MissingLatency: Int = 9999
    }

How can I access each element of reader.getLatency(conn,LocationAssignment), most importantly I want to access the last element or the third of the triple.

1 Answers1

0

Sweeper said in a comment:

Why does getLatency return Any. It should return Triple<Int, Int, Int>, shouldn't it?

which was the solution.

Wai Ha Lee
  • 8,598
  • 83
  • 57
  • 92
  • 1
    I've edited your answer a bit. Comments can be deleted at any time, so if somebody posts a comment that provides a solution, you can do what I did: link to the user, link to the comment, quote the comment. That way if the comment goes, people still have an answer to your question if they see it. – Wai Ha Lee Oct 15 '21 at 15:24