import java.lang.invoke.MethodHandle;
import java.lang.invoke.MethodHandles;
import java.lang.invoke.MethodType;
import java.util.List;

/**
 * @author Anastasiya Solodkaya.
 */
public class CountedLoopProposal4 {
    public static void main(String[] args) {
        MethodHandles.countedLoop(MethodHandles.constant(int.class, 13), MethodSet.init(String.class, List.class), MethodSet.body(String.class, int.class, String.class));
    }
    static class MethodSet {
        static String init(List<String> param){
            return "";
        }

        static String body(int counter, String s){
            return "";
        }

        static MethodHandle body(Class returnType, Class... params){
            try {
                return MethodHandles.lookup().findStatic(MethodSet.class, "body", MethodType.methodType(returnType, params));
            } catch (NoSuchMethodException | IllegalAccessException e) {
                e.printStackTrace();
                return null;
            }
        }

        static MethodHandle init(Class returnType, Class... params){
            try {
                return MethodHandles.lookup().findStatic(MethodSet.class, "init", MethodType.methodType(returnType, params));
            } catch (NoSuchMethodException | IllegalAccessException e) {
                e.printStackTrace();
                return null;
            }
        }


    }

}
