I am trying to create a class which models a program stack. Is it possible to make this class serializable
? I want to be able to use this as Akka
messages. Thanks!
public class ProgramStack<T>{
public final Queue<UnaryOperator<T>> programStack;
private T context;
ProgramStack(Queue<UnaryOperator<T>> programStack, T context) {
this.programStack = programStack;
this.context = context;
}
public void next() {
UnaryOperator function = programStack.poll();
function.apply(context);
}
public boolean hasNext() {
return !programStack.isEmpty();
}
}