zoukankan      html  css  js  c++  java
  • List集合中的末位元素置首位

    public static void replacement(List<JSONObject> jsonObjects) {

    List<JSONObject> jsonObjects1 = Lists.newArrayList();
    test.add("test1");
    test.add("test2");
    test.add("test3");

    System.out.println("更改前:" + JSON.toJSONString(test));

      // 用集合中的swap方法 (Collections.swap(list,o,i) (O:为元素目前所在位置,i:为要放置的位置)方法来进行元素调换)
    Collections.swap(test, test.size()-1, 0);

    System.out.println("更改后:" + JSON.toJSONString(test));
    }
  • 相关阅读:
    GPO
    GPO
    GPO
    Active Directory
    Active Directory
    Ethical Hacking
    Tree and Queries CodeForces
    数颜色 HYSBZ
    Powerful array CodeForces
    Group HDU
  • 原文地址:https://www.cnblogs.com/pxzbky/p/11779547.html
Copyright © 2011-2022 走看看