public static OptionalInt lastIndexOf(final Collection<?> c, final Object objToFind) {
        if (N.isNullOrEmpty(c)) {
            return OptionalInt.empty();
        }

        final int size = c.size();

        if (c instanceof List) {
            final List<Object> list = (List<Object>) c;

            if (c instanceof RandomAccess) {
                for (int i = size - 1; i >= 0; i--) {
                    if (N.equals(list.get(i), objToFind)) {
                        return OptionalInt.of(i);
                    }
                }
            } else {
                final ListIterator<Object> iter = list.listIterator(list.size());

                for (int i = size - 1; iter.hasPrevious(); i--) {
                    if (N.equals(iter.previous(), objToFind)) {
                        return OptionalInt.of(i);
                    }
                }
            }

            return OptionalInt.empty();
        } else if (c instanceof Deque) {
            final Iterator<Object> iter = ((Deque<Object>) c).descendingIterator();

            for (int i = size - 1; iter.hasNext(); i--) {
                if (N.equals(iter.next(), objToFind)) {
                    return OptionalInt.of(i);
                }
            }

            return OptionalInt.empty();
        } else {
            final Object[] a = c.toArray();

            for (int i = a.length - 1; i >= 0; i--) {
                if (N.equals(a[i], objToFind)) {
                    return OptionalInt.of(i);
                }
            }

            return OptionalInt.empty();
        }
    }
public static OptionalInt lastIndexOf ( final Collection < ? > c , final Object objToFind ) { if ( N . isNullOrEmpty ( c ) ) { return OptionalInt . empty ( ) ; } final int size = c . size ( ) ; if ( c instanceof List ) { final List < Object > list = ( List < Object > ) c ; if ( c instanceof RandomAccess ) { for ( int i = size - 1 ; i >= 0 ; i -- ) { if ( N . equals ( list . get ( i ) , objToFind ) ) { return OptionalInt . of ( i ) ; } } } else { final ListIterator < Object > iter = list . listIterator ( list . size ( ) ) ; for ( int i = size - 1 ; iter . hasPrevious ( ) ; i -- ) { if ( N . equals ( iter . previous ( ) , objToFind ) ) { return OptionalInt . of ( i ) ; } } } return OptionalInt . empty ( ) ; } else if ( c instanceof Deque ) { final Iterator < Object > iter = ( ( Deque < Object > ) c ) . descendingIterator ( ) ; for ( int i = size - 1 ; iter . hasNext ( ) ; i -- ) { if ( N . equals ( iter . next ( ) , objToFind ) ) { return OptionalInt . of ( i ) ; } } return OptionalInt . empty ( ) ; } else { final Object [ ] a = c . toArray ( ) ; for ( int i = a . length - 1 ; i >= 0 ; i -- ) { if ( N . equals ( a [ i ] , objToFind ) ) { return OptionalInt . of ( i ) ; } } return OptionalInt . empty ( ) ; } }
@param c
@param objToFind
@return