code: public static <T> int detectLastIndex(List<T> list, Predicate<? super T> predicate)
      {
          if (list instanceof RandomAccess)
          {
              return RandomAccessListIterate.detectLastIndex(list, predicate);
          }
          int size = list.size();
          int i = size - 1;
          ListIterator<T> reverseIterator = list.listIterator(size);
          while (reverseIterator.hasPrevious())
          {
              if (predicate.accept(reverseIterator.previous()))
              {
                  return i;
              }
              i--;
          }
          return -1;
      }
docs: Returns the last index where the predicate evaluates to true.
  Returns -1 for no matches.