Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

14
LINES

< > BotCompany Repo | #1008398 // cityToCountry

JavaX fragment (include)

static Cache<SS> cityToCountry_data = new Cache(func {
  L<SS> l = worldCitiesList();
  new SS data;
  for (SS line : l)
    putIfNotThere(data, toLower(line.get("name")), line.get("country"));
    
  // hotfix
  data.put("london", "United Kingdom");
  ret data;
});

static S cityToCountry(S city) {
  ret cityToCountry_data->get(toLower(city));
}

download  show line numbers  debug dex  old transpilations   

Travelled to 13 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1008398
Snippet name: cityToCountry
Eternal ID of this version: #1008398/5
Text MD5: 0831f7f6cfb165167c1b543c62a73e97
Author: stefan
Category: javax / a.i.
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2017-06-01 17:04:33
Source code size: 361 bytes / 14 lines
Pitched / IR pitched: No / No
Views / Downloads: 446 / 474
Version history: 4 change(s)
Referenced in: [show references]