語言

Collections.LastIndexOfSubList 方法

定義

回傳指定目標清單在指定來源清單中最後一次出現的起始位置,若沒有該事件則回傳 -1。

[Android.Runtime.Register("lastIndexOfSubList", "(Ljava/util/List;Ljava/util/List;)I", "")]
public static int LastIndexOfSubList(System.Collections.Generic.IList<object> source, System.Collections.Generic.IList<object> target);
[<Android.Runtime.Register("lastIndexOfSubList", "(Ljava/util/List;Ljava/util/List;)I", "")>]
static member LastIndexOfSubList : System.Collections.Generic.IList<obj> * System.Collections.Generic.IList<obj> -> int

參數

source
IList<Object>

搜尋最後一次出現 target的列表。

target
IList<Object>

作為子 source列表搜尋的列表。

傳回

指定目標清單在指定來源清單中最後一次出現的起始位置,若沒有該事件,則為 -1。

屬性

備註

回傳指定目標清單在指定來源清單中最後一次出現的起始位置,若沒有該事件則回傳 -1。 更正式地說,回傳使得 source.subList(i, i+target.size()).equals(target)的最高索引i,若不存在則返回 -1。 (若 target.size() > source.size()則返回 -1 )

此實作採用「暴力破解」技術,逐一遍檢視原始碼清單,尋找與目標位置的匹配。

在 1.4 版本加入。

的 java.util.Collections.lastIndexOfSubList(java.util.List<?>, java.util.List<?>)Java 檔。

此頁面的部分是根據 Android 開放原始碼專案所建立和共用的工作進行修改,並根據 Creative Commons 2.5 屬性授權中所述的詞彙使用。

適用於