Learned heaps in Java