Replace deprecated .size() with .length