In the setDirection() method i've done what is write to do, but it fails all the checks. I don't know why, but when in the method i change both the 2 if statements for the UP and DOWN:
if(snakeParts.get(0).y == snakeParts.get(1).y);
into this :
if(snakeParts.get(0).y != snakeParts.get(1).y);
the machine checks the first 2 points correctly. Thank you.