Java Collections indexOfSubList() MethodThe indexOfSubList() method of Java Collections class is used to get the starting position of the first occurrence of the specified target list within the specified source list. It returns -1 if there is no such occurrence in the specified list. SyntaxFollowing is the declaration of indexOfSubList() method: Parameter
ReturnsThe indexOfSubList() method returns the starting position of the first occurrence of the specified target list within the specified source list, or -1 if there is no such occurrence. ExceptionsNA Compatibility VersionJava 1.4 and above. Example 1Test it NowOutput: Target list starts at index: 2 Example 2Test it NowOutput: Target list starts at index: 2 Example 3Test it NowOutput: List :[kitu, mani, raj, karthi, rahul, gagan] IndexOfSubList: 3 Next TopicJava Collections Class |
We provides tutorials and interview questions of all technology like java tutorial, android, java frameworks
G-13, 2nd Floor, Sec-3, Noida, UP, 201301, India