public class EditDistance
extends java.lang.Object
Refer to a computer science text book for the definition of the "string edit distance".
Modifier and Type | Method | Description |
---|---|---|
static int |
editDistance(java.lang.String a,
java.lang.String b) |
Computes the edit distance between two strings.
|
static java.lang.String |
findNearest(java.lang.String key,
java.lang.String[] group) |
Finds the string in the
group closest to
key and returns it. |
static java.lang.String |
findNearest(java.lang.String key,
java.util.Collection<java.lang.String> group) |
Finds the string in the
group closest to
key and returns it. |
public static int editDistance(java.lang.String a, java.lang.String b)
The complexity is O(nm) where n=a.length() and m=b.length().
public static java.lang.String findNearest(java.lang.String key, java.lang.String[] group)
group
closest to
key
and returns it.public static java.lang.String findNearest(java.lang.String key, java.util.Collection<java.lang.String> group)
group
closest to
key
and returns it.Copyright © 2018 Oracle Corporation. All rights reserved.