如何替换list数组里面的内容

来源:互联网 发布:昆明理工大学教育网络 编辑:程序博客网 时间:2024/05/17 22:15
package com.yanshu.controller;
import java.util.*;
/**
 * 替换,json格式,响应时间
 * @author Administrator
 *
 */
public class Tihuan {
public static void getreplaceAll()
{
System.out.println("如何替换list数组里面的内容");
List list = Arrays.asList("one 123 three Four five six one three Four".split(" "));
     System.out.println("List :"+list);
     Collections.replaceAll(list, "123", "hundread");
     System.out.println("replaceAll: " + list);
}

  public static void main(String[] args) {
  getreplaceAll();
  }
}
阅读全文
0 0