I have a big list of coordinates (this form):
if(x == 1055 && y == 63 && z == 1117)
return blackwood;
if(x == 1053 && y == 63 && z == 1117)
return blackwood;
if(x == 1049 && y == 64 && z == 1113)
return blackwood;
if(x == 1054 && y == 63 && z == 1112)
return blackwood;
if(x == 1058 && y == 63 && z == 1112)
return blackwood;
if(x == 1062 && y == 64 && z == 1117)
return blackwood;
if(x == 1050 && y == 64 && z == 1117)
return blackwood;
if(x == 1062 && y == 64 && z == 1118)
return glass;
if(x == 1050 && y == 64 && z == 1118)
return andesite;
(Much longer than that)
But, when I call the method that execute these instructions, I have a lag (Not very long, but enough to have a freeze impression in-game).
So, my question is, how can I optimize this?
I was thinking about stocking these in a HashMap
and use HashMap.get(key)
, but, does HashMap.get(key)
iterate the list to find it out?