我使用setTimeout进行服务器连接,当我连接时,我想要反转我的Vector列表。我如何反转我的矢量列表?
我的Vector变量类
public class UriIterator
{
private var _availableAddresses: Vector.<SocketConnection> = new Vector.<SocketConnection>();
private var currentIndex:int = 0;
public function UriIterator(){
}
public function withAddress(host: String, port: int): UriIterator {
const a: SocketConnection = new SocketConnection(host, port);
_availableAddresses.push(a);
return this;
}
public function get next():SocketConnection {
var address = _availableAddresses[currentIndex];
currentIndex++;
if (currentIndex > _availableAddresses.length - 1)
currentIndex = 0;
return address;
}
}
并初始化我的矢量列表
public static const urisToTry: UriIterator = new UriIterator()
urisToTry.withAddress("https:// 123", 1234);
urisToTry.withAddress("https:// 123", 1234);
urisToTry.withAddress("https:// 123", 1234);
urisToTry.withAddress("https:// 123", 1234);
答案 0 :(得分:1)
reverse()在向量上与在数组上的工作方式相同。