Use enumeration? ? If the business is simple, it is recommended to use map to construct the index yourself. If the business is complex, you can use a graph database such as neo4j
Java’s enumeration is not only a simple function, but also very scalable. According to your requirements, write an example for you to see:
enum Country {
CN ("北京", "上海", "广州", "深圳"),
US ("华盛顿", "洛杉矶")
;
public final String[] cities;
public Country(String... cities) {
this.cities = cities;
}
}
In C language, for example, use 16-bit unsigned int to represent 0xabcd. The first two digits represent the country and the last two digits are the city. Do bit operations 0x0100 ~ 0x01ff China 0x0200 ~ 0x02ff United States
Use enumeration? ? If the business is simple, it is recommended to use map to construct the index yourself. If the business is complex, you can use a graph database such as neo4j
Java’s enumeration is not only a simple function, but also very scalable. According to your requirements, write an example for you to see:
In C language, for example, use 16-bit unsigned int to represent
0xabcd. The first two digits represent the country and the last two digits are the city. Do bit operations
0x0100 ~ 0x01ff China
0x0200 ~ 0x02ff United States