Quickly compare a string against a Collection in Java

前端 未结 3 2025
借酒劲吻你
借酒劲吻你 2020-12-18 06:42

I am trying to calculate edit distances of a string against a collection to find the closest match. My current problem is that the collection is very large (about 25000 item

3条回答
  •  太阳男子
    2020-12-18 06:58

    If your criteria for 'similar' define a total ordering, you should be able to define a Comparator and use a TreeSet to find the closest matches (eg using the ceiling and floor methods).

提交回复
热议问题