void (Collection<? extends PsiComment> comments, PsiElement lambda) { PsiElement anchor = PsiTreeUtil.getParentOfType(lambda, PsiStatement.class, PsiField.class); if (anchor == null) { anchor = lambda; } for (PsiComment comment : comments) { anchor.getParent().addBefore(comment, anchor); } }