java - 请教前辈们关于枚举值如何一对多关联额?
迷茫
迷茫 2017-04-17 16:46:34
0
3
596
迷茫
迷茫

业精于勤,荒于嬉;行成于思,毁于随。

reply all(3)
PHPzhong

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

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!