Java AbstractSequentialList类的get()方法
AbstractSequentialList类的get()方法用于在此列表中的指定位置显示元素。
语法如下
public E get(int index)
在这里,索引是您要从中获取元素的位置。
要使用Java中的AbstractSequentialList类,您需要导入以下包
import java.util.AbstractSequentialList;
以下是在Java中实现AbstractSequentialListget()方法的示例
示例
import java.util.LinkedList;
import java.util.AbstractSequentialList;
public class Demo {
public static void main(String[] args) {
AbstractSequentialList<Integer> absSequential = new LinkedList<>();
absSequential.add(10);
absSequential.add(25);
absSequential.add(60);
absSequential.add(70);
absSequential.add(195);
System.out.println("Elements in the AbstractSequentialList = "+absSequential);
System.out.println("Element at index 2 = " + absSequential.get(2));
System.out.println("Element at index 4 = " + absSequential.get(4));
}
}输出结果
Elements in the AbstractSequentialList = [10, 25, 60, 70, 195] Element at index 2 = 60 Element at index 4 = 195
热门推荐
1 训练狗狗工作
4 狗狗定点排便训练
5 狗狗训练吠叫
6 狗狗尿垫训练
7 狗狗训练座
8 狗狗训练攻略
9 狗狗训练记
10 做训练狗狗
11 狗狗训练词
12 狗狗谢谢怎么训练
13 狗狗训练如厕
14 狗狗太凶怎么训练
15 狗狗训练它
16 狗狗克制训练
17 训练基地狗狗
18 怎么样训练狗狗大小硬