public static void addVariants(Collection<?> variants, CompletionResultSet result) {
    for (Object each : variants) {
      LookupElement e;
      if (each instanceof LookupElement) {
        e = (LookupElement)each;
      }
      else if (each instanceof String) {
        e = LookupElementBuilder.create((String)each);
      }
      else if (each instanceof PsiNamedElement) {
        e = LookupElementBuilder.create((PsiNamedElement)each);
      }
      else {
        e = LookupElementBuilder.create(each, String.valueOf(each));
      }
      result.addElement(e);
    }
  }
public static void addVariants(Collection<?> variants, CompletionResultSet result)