Java 教程
以下實(shí)例演示了如何使用 Collections 類(lèi)的 indexOfSubList() 和 lastIndexOfSubList() 方法來(lái)查看子列表是否在列表中,并查看子列表在列表中所在的位置:
以上代碼運(yùn)行輸出結(jié)果為:
List :[one, Two, three, Four, five, six, one, three, Four] 子列表 :[three, Four] indexOfSubList: 2 lastIndexOfSubList: 7其他擴(kuò)展