Example usage for org.apache.commons.text.similarity LevenshteinDistance getDefaultInstance

List of usage examples for org.apache.commons.text.similarity LevenshteinDistance getDefaultInstance

Introduction

In this page you can find the example usage for org.apache.commons.text.similarity LevenshteinDistance getDefaultInstance.

Prototype

public static LevenshteinDistance getDefaultInstance() 

Source Link

Document

Gets the default instance.

Usage

From source file:org.egov.infra.admin.master.service.ActionService.java

private Action findNearestMatchingAction(String url, List<Action> actions) {
    return actions.isEmpty() ? null
            : actions.parallelStream()//from   ww  w.  j ava  2  s.c  om
                    .filter(action -> LevenshteinDistance.getDefaultInstance().apply(url, action.getUrl()) < 1)
                    .findFirst().orElse(actions.get(0));
}