我希望能够创建充满我自己的方法的列表(集合、数组),并在迭代的每个步骤中调用该方法。对此最好的解决方案是什么?
我想要这样的东西:
List a = new List(); a.add(myCustomMethod1()); a.add(myCustomMethod2()); Object o = new Object(); for (Method m : a){ m(o); }
java collections iterator
collections ×1
iterator ×1
java ×1