newlist.java

来自「java 泛型的程序」· Java 代码 · 共 37 行

JAVA
37
字号
import java.util.*;
class NewList<Double>
{
	//创建新的List集合类型对象list,使其存储内容都Double类型数据
	public List<Double> list = new LinkedList<Double>();
	
	//方法过载:向LinkedList中添加数据
	public void add(Double d)
	{
		list.add(d);
	}
	
	//方法过载:获取LinkedList中index指定位置的数据
	public Double get(int index)
	{
		return list.get(index);
	}
	
	//方法过载:获取Iterator对象
	public Iterator<Double> iterator()
	{
		return list.iterator();
	}
	
	//方法过载:移除LinkedList中index指定位置的数据
	public Double remove(int index)
	{
		return list.remove(index);
	}
	
	//方法过载:设置LinkedList中index指定位置的数据
	public Double set(int index,Double d)
	{
		return list.set(index,d);
	}
}

⌨️ 快捷键说明

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