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. More formally, returns the lowest index i
such that source.subList(i, i+target.size()).equals(target)
,
or -1 if there is no such index. (Returns -1 if
target.size() > source.size()
)
This implementation uses the "brute force" technique of scanning over the source list, looking for a match with the target at each location in turn.
source | the list in which to search for the first occurrence
of target . | |
target | the list to search for as a subList of source . |
Diagram: Collections