private static List<PsiExpression> generatedList(PsiElement context, int size, IntFunction<String> generator) {
    PsiElementFactory factory = JavaPsiFacade.getElementFactory(context.getProject());
    return new AbstractList<>() {
      @Override
      public PsiExpression get(int index) {
        return factory.createExpressionFromText(generator.apply(index), context);
      }

      @Override
      public int size() {
        return size;
      }
    };
  }
private static List<PsiExpression> generatedList(PsiElement context, int size, IntFunction<String> generator)