`public List subList(int fromIndex, int toIndex)`:它返回此 List 的部分在 fromIndex(包含)和 toIndex(独占)之间的视图。 (如果 fromIndex 和 toIndex 相等,则返回的 List 为空。)返回的 List 由此 List 支持,因此返回 List 中的更改将反映在此 List 中,反之亦然。返回的 List 支持此 List 支持的所有可选 List 操作。
此方法消除了对显式范围操作的需要(对于数组通常存在的排序)。任何期望 List 的操作都可以通过操作 subList 视图而不是整个 List 来用作范围操作。例如,以下习语从 List 中删除了一系列元素:
`public List subList(int fromIndex, int toIndex)`:它返回此`List`在`fromIndex`(包含)和`toIndex`(独占)之间的视图。(如果`fromIndex`和`toIndex`相等,则返回的`List`为空。)返回的`List`由此`List`支持,因此返回`List`中的更改将反映在此`List`中,反之亦然。返回的`List`支持此`List`支持的所有可选`List`操作。
在本教程中,我们将学习如何使用索引从[Vector 中删除元素。我们将使用 Vector 类的](https://beginnersbook.com/2014/06/search-elements-in-vector-using-index-java-example/"Search elements in Vector using index – Java example")[remove(int index)方法](https://docs.oracle.com/javase/7/docs/api/java/util/Vector.html#remove(int))。
`public E remove(int index)`:删除此 Vector 中指定位置的元素。将任何后续元素向左移位(从索引中减去一个)。返回从 [Vector](https://beginnersbook.com/2013/12/vector-in-java/"Vector in Java")中删除的元素。
`public E remove(int index)`:删除此`Vector`中指定位置的元素。将任何后续元素向左移位(从索引中减去一个)。返回从[`Vector`](https://beginnersbook.com/2013/12/vector-in-java/)中删除的元素。