我需要按地区 ID 获取邮政编码的数组列表,但我的地区 ID 不在提供的顺序中,并且邮政编码必须与提到的地区 ID 相关联。(这个数据是一个小例子,我有数千个邮政编码的csv文件)请帮我用Java写一个正确的逻辑。
Zip Codes V/s Region Ids = {"71854 , 612" ; "71865, 612"; "88008, 765"; "88021, 765" ; "88252 , 612"}
我需要按地区 ID 获取邮政编码的数组列表,但我的地区 ID 不在提供的顺序中,并且邮政编码必须与提到的地区 ID 相关联。(这个数据是一个小例子,我有数千个邮政编码的csv文件)请帮我用Java写一个正确的逻辑。
Zip Codes V/s Region Ids = {"71854 , 612" ; "71865, 612"; "88008, 765"; "88021, 765" ; "88252 , 612"}
You can do this of two ways.
first declare a structure that contain the two values required and then fill an array with the values, as show in the example.
struct Data{
int zip_code, region_id;
Data() {}
Data(int z, int r) {
zip_code = z;
region_id = r;
}
};
Data my_list[MAXN];
second declare declare two parallel arrays and fill these with the data requiered
int zip_code[MAX] = {71854, 71865, 88008, 88021, 88252};
int region_id[MAX] = {612, 612, 765, 765, 612};