public ArrayList < TcpEndpoint > peers ( ) { tcp_endpoint_vector v = alert . peers ( ) ; int size = ( int ) v . size ( ) ; ArrayList < TcpEndpoint > peers = new ArrayList <> ( size ) ; for ( int i = 0 ; i < size ; i ++ ) { tcp_endpoint endp = v . get ( i ) ; String ip = new Address ( endp . address ( ) ) . toString ( ) ; // clone peers . add ( new TcpEndpoint ( ip , endp . port ( ) ) ) ; } return peers ; }
This method creates a new list each time is called .