I'm trying to make a simple little class where I can make something similar to a macro in C/C++. Basically I want to be able to call the following code when I need to perform a few actions though a list of objects, like so:
new IteratableList{
void action() {
// do something
}
}.perform();
I haven't programmed in Java in quite a while, and I can't figure out what is wrong with my code when I try to add the abstract action method:
import java.util.List;
import java.util.Iterator;
public abstract class IteratableList<T> {
public void perfrom(List<T> ls) {
Iterator<T> l = ls.iterator();
while (l.hasNext())
action(l.next());
}
private abstract void action(<T> obj);
}
My code doesn't get any errors until I type that last method. I get errors telling me to remove abstract from the method header, and when I change that I get a list of other errors. I feel like I missed a fundamental thing here. Does any one see a glaring error?