小编use*_*019的帖子

Java颠倒了在for循环中访问列表的顺序

我想颠倒在for()中访问List的顺序

这是我的实际代码

for(int i = 0; i < states.size(); i++) {
    System.out.println(states.size());
    states.get(i).update(true); // restore the first blockstate
    states.remove(i); // remove the first blockstate from the list
}
Run Code Online (Sandbox Code Playgroud)

这段代码有效,但我想反过来.我已经尝试过其他方式,比如使用,i--但它没有用.有人可以提出建议吗?

java

2
推荐指数
1
解决办法
77
查看次数

c#在外面尝试并捕获+变量

如何在try-catch外获取变量x,y和z?

这是我的代码:

public static void mudarSpawn_1(GtaPlayer player, string coordenadas)
{
    char[] delimiterChars = { ' ', ',' };
    string text = coordenadas;
    string[] words = text.Split(delimiterChars);
    try
    {
         float x = float.Parse(words[0], System.Globalization.CultureInfo.InvariantCulture);
         float y = float.Parse(words[1], System.Globalization.CultureInfo.InvariantCulture);
         float z = float.Parse(words[1], System.Globalization.CultureInfo.InvariantCulture);
    }
    catch (Exception e)
    {
        player.SendClientMessage(Color.DarkOrange, "Os valores de x,y e z não foram inseridos de forma correcta, apenas podes usar numeros");
        player.SendClientMessage(Color.DarkOrange, "Ex: /mudarspawn3 6321.6 , 96321.38 , 66322.2 ou /mudarspawn3 6321.6 96321.38 66322.2");
    }

    MSGameMysql.mudarspawn1(x, …
Run Code Online (Sandbox Code Playgroud)

c# try-catch

0
推荐指数
1
解决办法
123
查看次数

标签 统计

c# ×1

java ×1

try-catch ×1