Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -284,12 +284,16 @@ public CharSequence longestCommonSubsequence(final CharSequence left, final Char
* @param left first character sequence.
* @param right second character sequence.
* @return longest common substring length array.
* @throws IllegalArgumentException if either String input {@code null}.
* @deprecated Deprecated as of 1.10. A more efficient implementation for calculating LCS is now available.
* Use {@link #longestCommonSubsequence(CharSequence, CharSequence)} instead to directly calculate the LCS.
* This method will be removed in 2.0.
*/
@Deprecated
public int[][] longestCommonSubstringLengthArray(final CharSequence left, final CharSequence right) {
if (left == null || right == null) {
throw new IllegalArgumentException("Inputs must not be null");
}
final int[][] lcsLengthArray = new int[left.length() + 1][right.length() + 1];
for (int i = 0; i < left.length(); i++) {
for (int j = 0; j < right.length(); j++) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,24 @@ void testGettingLongestCommonSubsequenceApplyStringNull() {
assertThrows(IllegalArgumentException.class, () -> subject.apply(" ", null));
}

@Test
@SuppressWarnings("deprecation")
void testGettingLongestCommonSubstringLengthArrayNullNull() {
assertThrows(IllegalArgumentException.class, () -> subject.longestCommonSubstringLengthArray(null, null));
}

@Test
@SuppressWarnings("deprecation")
void testGettingLongestCommonSubstringLengthArrayNullString() {
assertThrows(IllegalArgumentException.class, () -> subject.longestCommonSubstringLengthArray(null, "right"));
}

@Test
@SuppressWarnings("deprecation")
void testGettingLongestCommonSubstringLengthArrayStringNull() {
assertThrows(IllegalArgumentException.class, () -> subject.longestCommonSubstringLengthArray(" ", null));
}

@Test
void testGettingLongestCommonSubsequenceNullNull() {
assertThrows(IllegalArgumentException.class, () -> subject.longestCommonSubsequence(null, null));
Expand Down