Here you can find the source of getSearchTermIndexLocationsOrNull(final List
public static List<Integer> getSearchTermIndexLocationsOrNull(final List<String> pageWords, final String searchTerm)
//package com.java2s; //License from project: MIT License import java.util.ArrayList; import java.util.List; public class Main { public static List<Integer> getSearchTermIndexLocationsOrNull(final List<String> pageWords, final String searchTerm) { String[] tokanizedSearchTerm = getTokanizedSearchTerm(searchTerm.toUpperCase()); List<Integer> indexLocations = new ArrayList<Integer>(); for (int i = 0; i < pageWords.size(); i++) { for (String token : tokanizedSearchTerm) { if (token.equals(pageWords.get(i))) { indexLocations.add(i); }// w w w. ja v a2s . com } } return indexLocations; } public static String[] getTokanizedSearchTerm(final String searchTerm) { return searchTerm.split(" "); } }