⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 testlistaddmethodvsaddallmethod.java

📁 很好的j2ee系统 很好的j2ee系统
💻 JAVA
字号:
package org.perfect.struts.test;

import java.util.ArrayList;
import java.util.List;

//测试list的add方法和addAll方法;
//add是无论你加什么进去。都当成一个元素。
//addAll如果你加一个list进去。就在后面加到这个list后面。list相应增加的长度也就是addAll进去list的长度
//[[1, 2, 3], [1, 2, 3], 1, 2, 3]
public class TestListAddMethodVsAddAllMethod {

	private static List theMainList = new ArrayList();

	public List makeList() {

		List theSubList = new ArrayList();
		theSubList.add("1");
		theSubList.add("2");
		theSubList.add("3");

		return theSubList;
	}

	public static void main(String[] args) {
		TestListAddMethodVsAddAllMethod shit = new TestListAddMethodVsAddAllMethod();
		theMainList.add(shit.makeList());
		theMainList.add(shit.makeList());
		theMainList.addAll(shit.makeList());
		System.out.println(theMainList.toString());
	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -