An exploration of how to implement co-recursion in java