public TransportCandidate getPreferredCandidate ( ) { TransportCandidate result = null ; ArrayList < ICECandidate > cands = new ArrayList <> ( ) ; for ( TransportCandidate tpcan : getCandidatesList ( ) ) { if ( tpcan instanceof ICECandidate ) cands . add ( ( ICECandidate ) tpcan ) ; } // (ArrayList<ICECandidate>) getCandidatesList(); if ( cands . size ( ) > 0 ) { Collections . sort ( cands ) ; // Return the last candidate result = cands . get ( cands . size ( ) - 1 ) ; LOGGER . fine ( "Result: " + result . getIp ( ) ) ; } return result ; }
Get the candidate with the highest preference .