java - enum.values() - is an order of returned enums deterministic -
i have enum some_enum: 
public enum some_enum {   en_one,   en_two,   en_three; }   will some_enum.values() return enums in order of enum declarations: en_one, en_two, en_three? rule or not guaranteed not changed in next jdk releases? 
the java language specification uses explicit language:
@return array containing constants of enum type, in order they're declared [source]
so, yes, returned in declaration order. it's worth noting order might change on time if changes class careful how use this.
Comments
Post a Comment