Works on java <8