default <V> QuadFunction<T1, T2, T3, T4, V> andThen(Function<? super R, ? extends V> after) { Objects.requireNonNull(after); return (T1 t1, T2 t2, T3 t3, T4 t4) -> after.apply(apply(t1, t2, t3, t4)); } }
/** * <p>countSubStr.</p> * * @return a {@link java.util.function.BiFunction} object. */ static BiFunction<String, String, Long> countSubStr() { return (value, subStr) -> countSubStrCaseSensitive().apply(value, subStr, true, false); }
/** * Test if value ends with search. * <p> * param value input string * param search string to search * param caseSensitive true or false * * @return true or false */ static TriFunction<String, String, Boolean, Boolean> endsWithCaseSensitive() { return (value, search, caseSensitive) -> endsWithCaseSensitiveUpTo() .apply(value, search, value.length(), caseSensitive); }
/** * <p>countSubStrCaseSensitive.</p> * * @return a {@link org.rapidpm.frp.functions.QuadFunction} object. */ static QuadFunction<String, String, Boolean, Boolean, Long> countSubStrCaseSensitive() { return (value, subStr, caseSensitive, allowOverlapping) -> countSubStrCaseSensitiveOverlapping() .apply( caseSensitive ? value : value.toLowerCase(), caseSensitive ? subStr : subStr.toLowerCase(), allowOverlapping, 0L); }
/** * This method returns the index within the calling String object of the last occurrence of the specified value, searching backwards from the offset. * Returns -1 if the value is not found. The search starts from the end and case sensitive. * <p> * param value The input String * param needle The search String * param caseSensitive true or false * * @return Return position of the last occurrence of 'needle'. */ static TriFunction<String, String, Boolean, Integer> lastIndexOfCaseSensitive() { return (value, needle, caseSensitive) -> lastIndexOfCaseSensitiveWithIndexOf().apply(value, needle, value.length(), caseSensitive); }
/** * <p>countSubStrCaseSensitiveOverlapping.</p> * * @return a {@link org.rapidpm.frp.functions.QuadFunction} object. */ static QuadFunction<String, String, Boolean, Long, Long> countSubStrCaseSensitiveOverlapping() { return (value, subStr, allowOverlapping, count) -> { int position = value.indexOf(subStr); if (position == - 1) { return count; } int offset; if (! allowOverlapping) { offset = position + subStr.length(); } else { offset = position + 1; } return countSubStrCaseSensitiveOverlapping().apply(value.substring(offset), subStr, allowOverlapping, ++ count); }; }