code: public static @CheckForNull <T extends Item> T findNearest(Class<T> type, String name, ItemGroup context) {
          List<String> names = new ArrayList<>();
          for (T item: Jenkins.getInstance().allItems(type)) {
              names.add(item.getRelativeNameFrom(context));
          }
          String nearest = EditDistance.findNearest(name, names);
          return Jenkins.getInstance().getItem(nearest, context, type);
      }
docs: Finds an item whose name (when referenced from the specified context) is closest to the given name.
  @param <T> the type of item being considered
  @param type same as {@code T}
  @param name the supplied name
  @param context a context to start from (used to compute relative names)
  @return the closest available item
  @since 1.538