code: public static <E> int search(List<E> list, E value, int occurrence) {
          if(occurrence <= 0 || occurrence > list.size()) {
              throw new IllegalArgumentException("Occurrence must be greater or equal to 1 and less than "
                      + "the list length: " + occurrence);
          }
          int valuesSeen = 0;
          for(int i = 0; i < list.size(); i++) {
              if(list.get(i) == value) {
                  valuesSeen++;
                  if(valuesSeen == occurrence) {
                      return i;
                  }
              }
          }
          return -1;
      }
docs: Search for the value in the list and return the index of the specified occurrence from the
  beginning of the list. The run time of this algorithm depends on the
  implementation of the list. It is advised to use an array based implementation
  to achieve O(n) runtime.
  
  @param <E> the type of elements in this list.
  
  @param list list that we are searching in.
  @param value value that is being searched in the list.
  @param occurrence number of times we have seen the value before returning the index.
  
  @return the index where the value is found in the list, else -1.