Adding waits in Java client (FIXED)

I have just updated my version of appium java client from 3.4.1 to 7.0.0 and my wait.until are now broken.

I have tried googling for some examples of how to use waits in this new version, but to no avail. Can anyone provide a short example of using wait.until in this version of the java client?

EDIT: I fixed this by importing

import java.util.function.Function;

and changing the source from 7 to 8.