This is NOT part of any supported API. If you write code that depends on this, you do so at your own risk. This code and its internal interfaces are subject to change or deletion without notice.
| Modifier and Type | Class and Description |
|---|---|
| public static class | StringUtils.
Call |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public static int | indexOfIgnoreCase(String text, String str)
Case insensitive version of |
| public static int | indexOfIgnoreCase(String text, String str, int startIndex)
Case insensitive version of |
| public static String | |
| public static String |
| StringUtils | back to summary |
|---|---|
| public StringUtils() | |
| indexOfIgnoreCase | back to summary |
|---|---|
| public static int indexOfIgnoreCase(String text, String str) Case insensitive version of | |
| indexOfIgnoreCase | back to summary |
|---|---|
| public static int indexOfIgnoreCase(String text, String str, int startIndex) Case insensitive version of | |
| toLowerCase | back to summary |
|---|---|
| public static String toLowerCase(String source) Converts the given String to lower case using the | |
| toUpperCase | back to summary |
|---|---|
| public static String toUpperCase(String source) Converts the given String to upper case using the | |
of(String, String) to calculate the distance.
record Pair(String word, int distance) { }
var suggestions = vocabulary.stream()
.map(v -> new Pair(v, DamerauLevenshteinDistance.of(v, misspelledWord)))
.filter(p -> Double.compare(1.0 / 3, ((double) p.distance()) / p.word().length()) >= 0)
.sorted(Comparator.comparingDouble(Pair::distance))
.limit(3)
.toList();
| Modifier and Type | Field and Description |
|---|---|
| private final String | |
| private final String | |
| private Map | |
| private final int[][] | |
| private final int | |
| private int[] | |
| private static final int | |
| private static final int | |
| private static final int | |
| private static final int |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| private int | |
| private int | |
| private int | |
| private void | |
| private void | |
| private int | |
| private static int | |
| public static int |
| a | back to summary |
|---|---|
| private final String a | |
| b | back to summary |
|---|---|
| private final String b | |
| bigDA | back to summary |
|---|---|
| private Map<Character, Integer> bigDA | |
| h | back to summary |
|---|---|
| private final int[][] h | |
| INF | back to summary |
|---|---|
| private final int INF | |
| smallDA | back to summary |
|---|---|
| private int[] smallDA | |
| Wc | back to summary |
|---|---|
| private static final int Wc | |
| Wd | back to summary |
|---|---|
| private static final int Wd | |
| Wi | back to summary |
|---|---|
| private static final int Wi | |
| Ws | back to summary |
|---|---|
| private static final int Ws | |
| DamerauLevenshteinDistance | back to summary |
|---|---|
| private DamerauLevenshteinDistance(String a, String b) | |
| calculate | back to summary |
|---|---|
| private int calculate() | |
| characterAt | back to summary |
|---|---|
| private int characterAt(String s, int i) | |
| da | back to summary |
|---|---|
| private int da(int i) | |
| da | back to summary |
|---|---|
| private void da(int i, int value) | |
| h | back to summary |
|---|---|
| private void h(int i, int j, int value) | |
| h | back to summary |
|---|---|
| private int h(int i, int j) | |
| min | back to summary |
|---|---|
| private static int min(int a, int b, int c, int d) | |
| of | back to summary |
|---|---|
| public static int of(String a, String b) Returns the edit distance between two strings. The distance returned from this method has the following properties:
Implementation Specification This method is safe to be called by multiple threads.
| |