Implementation of fuzzy query in Java list
•
Java
For example, I have the following list, which stores multiple employee objects. Then I want to perform a fuzzy query on the list according to the name of the employee object. Is there any good solution?
For example, if the query condition I entered is "Wang", the list containing only employee1 should be returned.
Mode 1:
The above one is case sensitive. If case insensitive is required, change it to:
Pattern pattern = Pattern. compile(name,Pattern.CASE_INSENSITIVE);
And the above is an exact query. If you want fuzzy matching, matcher Find () can perform fuzzy matching
Mode 2:
The above is all about the implementation method of fuzzy query in Java list brought by Xiaobian. I hope you can support more programming tips~
The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
二维码