diff --git a/Programmierung2/src/streams/übungen/Animal/Animal.java b/Programmierung2/src/streams/übungen/Animal/Animal.java new file mode 100644 index 0000000..c01619b --- /dev/null +++ b/Programmierung2/src/streams/übungen/Animal/Animal.java @@ -0,0 +1,184 @@ +package streams.übungen.Animal; + +import java.util.*; +import java.util.stream.Collectors; + +public abstract class Animal { + private int legs; + + public Animal(int legs) { + this.legs = legs; + } + + public int getLegs() { + return legs; + } + public void walk() { + System.out.println( + String.format("Animal with %d legs is walking now...",legs) + ); + } + + + + @Override + public String toString() { + return "Animal [legs=" + legs + "]"; + } + + public abstract void eat(); // abstract method + + public static void main(String[] args) { + ArrayList animals = new ArrayList<>(); + // Katzen hinzufügen + animals.add(new Cat("Tom")); + animals.add(new Cat("Tom")); + animals.add(new Cat("Whiskers")); + animals.add(new Cat("Mittens")); + animals.add(new Cat("Felix")); + + // Fische hinzufügen + animals.add(new Fish("Nemo")); + animals.add(new Fish("Dory")); + animals.add(new Fish("Bubbles")); + animals.add(new Fish("Goldie")); + animals.add(new Fish("Splash")); + + // Spinnen hinzufügen + animals.add(new Spider()); + animals.add(new Spider()); + + //animal with the highest number of legs + Animal a = animals.stream() + .max(Comparator.comparingInt(d -> d.getLegs())) + .orElse(null); + + + //Q.5) Find the total number of legs + int max = animals.stream() + .map(t -> t.getLegs()) + .mapToInt(Integer::intValue) + .sum(); + + //Group the animals by their number of legs + Map animalMap = animals.stream() + .collect(Collectors.groupingBy(d -> d, Collectors.counting())); + + animalMap.forEach((animal, count) -> + System.out.println(animal + " -> " + count + " mal")); + } +} + +abstract interface Pet { + abstract void setName(String name); + + public String getName(); + + abstract public void play(); + + static void playIfPet(Animal animal) { + if (animal instanceof Pet) + ((Pet) animal).play(); + } +} + + +class Cat extends Animal implements Pet { + private String name; + + public Cat() { + this("Garfield"); + } + + public Cat(String name) { + super(4); + this.name = name; + } + + @Override + public void setName(String name) { + this.name = name; + } + + @Override + public String getName() { + return name; + } + + @Override + public void play() { + System.out.println(String.format("%s is playing now...", name)); + } + + @Override + public void eat() { + System.out.println(String.format("%s is eating now...", name)); + } + + @Override + public String toString() { + return "Cat [name=" + name + "]"; + } + + + +} + + +class Fish extends Animal implements Pet { + private String name; + + public Fish(String name) { + super(0); + this.name = name; + } + + @Override + public void setName(String name) { + this.name = name; + } + + @Override + public String getName() { + return name; + } + + @Override + public void play() { + System.out.println(String.format("%s is playing now...", name)); + } + + @Override + public void eat() { + System.out.println(String.format("%s is eating now...", name)); + } + + @Override + public void walk() { + System.out.println(String.format("%s is swimming now...", name)); + } + + @Override + public String toString() { + return "Fish [name=" + name + "]"; + } + +} + +class Spider extends Animal { + + public Spider() { + super(8); + } + + @Override + public void eat() { + System.out.println("Spider is eating now..."); + } + + @Override + public String toString() { + return "Spider [=" + getLegs() + ", toString()=" + super.toString()+ "]"; + } + +} diff --git a/Programmierung2/src/streams/übungen/City.java b/Programmierung2/src/streams/übungen/City.java new file mode 100644 index 0000000..eab5050 --- /dev/null +++ b/Programmierung2/src/streams/übungen/City.java @@ -0,0 +1,40 @@ +package streams.übungen; + +public class City { + private int id; + private String name; + private Integer population; + private String countryCode; + + public City() { + } + + public City(int id, String name, String countryCode, Integer population) { + this.id = id; + this.name = name; + this.population = population; + this.countryCode = countryCode; + } + + public int getId() { + return id; + } + + public String getName() { + return name; + } + + public Integer getPopulation() { + return population; + } + + public String getCountryCode() { + return countryCode; + } + + @Override + public String toString() { + return "City [id=" + id + ", name=" + name + ", population=" + population + ", countryCode=" + countryCode + + "]"; + }; +} diff --git a/Programmierung2/src/streams/übungen/CityTest.java b/Programmierung2/src/streams/übungen/CityTest.java new file mode 100644 index 0000000..f6aa81c --- /dev/null +++ b/Programmierung2/src/streams/übungen/CityTest.java @@ -0,0 +1,1044 @@ +package streams.übungen; + +import java.util.*; + +public class CityTest { + Map cities; + + CityTest(){ + cities = new HashMap<>(); + createCities1(); + } + public void createCities1() { + cities.put(1, new City(1, "Kabul", "AFG", 1780000)); + cities.put(2, new City(2, "Qandahar", "AFG", 237500)); + cities.put(3, new City(3, "Herat", "AFG", 186800)); + cities.put(4, new City(4, "Mazar-e-Sharif", "AFG", 127800)); + cities.put(5, new City(5, "Amsterdam", "NLD", 731200)); + cities.put(6, new City(6, "Rotterdam", "NLD", 593321)); + cities.put(7, new City(7, "Haag", "NLD", 440900)); + cities.put(8, new City(8, "Utrecht", "NLD", 234323)); + cities.put(9, new City(9, "Eindhoven", "NLD", 201843)); + cities.put(10, new City(10, "Tilburg", "NLD", 193238)); + cities.put(11, new City(11, "Groningen", "NLD", 172701)); + cities.put(12, new City(12, "Breda", "NLD", 160398)); + cities.put(13, new City(13, "Apeldoorn", "NLD", 153491)); + cities.put(14, new City(14, "Nijmegen", "NLD", 152463)); + cities.put(15, new City(15, "Enschede", "NLD", 149544)); + cities.put(16, new City(16, "Haarlem", "NLD", 148772)); + cities.put(17, new City(17, "Almere", "NLD", 142465)); + cities.put(18, new City(18, "Arnhem", "NLD", 138020)); + cities.put(19, new City(19, "Zaanstad", "NLD", 135621)); + cities.put(20, new City(20, "ïs-Hertogenbosch", "NLD", 129170)); + cities.put(21, new City(21, "Amersfoort", "NLD", 126270)); + cities.put(22, new City(22, "Maastricht", "NLD", 122087)); + cities.put(23, new City(23, "Dordrecht", "NLD", 119811)); + cities.put(24, new City(24, "Leiden", "NLD", 117196)); + cities.put(25, new City(25, "Haarlemmermeer", "NLD", 110722)); + cities.put(26, new City(26, "Zoetermeer", "NLD", 110214)); + cities.put(27, new City(27, "Emmen", "NLD", 105853)); + cities.put(28, new City(28, "Zwolle", "NLD", 105819)); + cities.put(29, new City(29, "Ede", "NLD", 101574)); + cities.put(30, new City(30, "Delft", "NLD", 95268)); + cities.put(31, new City(31, "Heerlen", "NLD", 95052)); + cities.put(32, new City(32, "Alkmaar", "NLD", 92713)); + cities.put(33, new City(33, "Willemstad", "ANT", 2345)); + cities.put(34, new City(34, "Tirana", "ALB", 270000)); + cities.put(35, new City(35, "Alger", "DZA", 2168000)); + cities.put(36, new City(36, "Oran", "DZA", 609823)); + cities.put(37, new City(37, "Constantine", "DZA", 443727)); + cities.put(38, new City(38, "Annaba", "DZA", 222518)); + cities.put(39, new City(39, "Batna", "DZA", 183377)); + cities.put(40, new City(40, "S‚tif", "DZA", 179055)); + cities.put(41, new City(41, "Sidi Bel AbbÅ s", "DZA", 153106)); + cities.put(42, new City(42, "Skikda", "DZA", 128747)); + cities.put(43, new City(43, "Biskra", "DZA", 128281)); + cities.put(44, new City(44, "Blida (el-Boulaida)", "DZA", 127284)); + cities.put(45, new City(45, "B‚ja‹a", "DZA", 117162)); + cities.put(46, new City(46, "Mostaganem", "DZA", 115212)); + cities.put(47, new City(47, "T‚bessa", "DZA", 112007)); + cities.put(48, new City(48, "Tlemcen (Tilimsen)", "DZA", 110242)); + cities.put(49, new City(49, "B‚char", "DZA", 107311)); + cities.put(50, new City(50, "Tiaret", "DZA", 100118)); + cities.put(51, new City(51, "Ech-Chleff (el-Asnam)", "DZA", 96794)); + cities.put(52, new City(52, "Gharda‹a", "DZA", 89415)); + cities.put(53, new City(53, "Tafuna", "ASM", 5200)); + cities.put(54, new City(54, "Fagatogo", "ASM", 2323)); + cities.put(55, new City(55, "Andorra la Vella", "AND", 21189)); + cities.put(56, new City(56, "Luanda", "AGO", 2022000)); + cities.put(57, new City(57, "Huambo", "AGO", 163100)); + cities.put(58, new City(58, "Lobito", "AGO", 130000)); + cities.put(59, new City(59, "Benguela", "AGO", 128300)); + cities.put(60, new City(60, "Namibe", "AGO", 118200)); + cities.put(61, new City(61, "South Hill", "AIA", 961)); + cities.put(62, new City(62, "The Valley", "AIA", 595)); + cities.put(63, new City(63, "Saint Johnïs", "ATG", 24000)); + cities.put(64, new City(64, "Dubai", "ARE", 669181)); + cities.put(65, new City(65, "Abu Dhabi", "ARE", 398695)); + cities.put(66, new City(66, "Sharja", "ARE", 320095)); + cities.put(67, new City(67, "al-Ayn", "ARE", 225970)); + cities.put(68, new City(68, "Ajman", "ARE", 114395)); + cities.put(69, new City(69, "Buenos Aires", "ARG", 2982146)); + cities.put(70, new City(70, "La Matanza", "ARG", 1266461)); + cities.put(71, new City(71, "C¢rdoba", "ARG", 1157507)); + cities.put(72, new City(72, "Rosario", "ARG", 907718)); + cities.put(73, new City(73, "Lomas de Zamora", "ARG", 622013)); + cities.put(74, new City(74, "Quilmes", "ARG", 559249)); + cities.put(75, new City(75, "Almirante Brown", "ARG", 538918)); + cities.put(76, new City(76, "La Plata", "ARG", 521936)); + cities.put(77, new City(77, "Mar del Plata", "ARG", 512880)); + cities.put(78, new City(78, "San Miguel de Tucum n", "ARG", 470809)); + cities.put(79, new City(79, "Lan£s", "ARG", 469735)); + cities.put(80, new City(80, "Merlo", "ARG", 463846)); + cities.put(81, new City(81, "General San Mart¡n", "ARG", 422542)); + cities.put(82, new City(82, "Salta", "ARG", 367550)); + cities.put(83, new City(83, "Moreno", "ARG", 356993)); + cities.put(84, new City(84, "Santa F‚", "ARG", 353063)); + cities.put(85, new City(85, "Avellaneda", "ARG", 353046)); + cities.put(86, new City(86, "Tres de Febrero", "ARG", 352311)); + cities.put(87, new City(87, "Mor¢n", "ARG", 349246)); + cities.put(88, new City(88, "Florencio Varela", "ARG", 315432)); + cities.put(89, new City(89, "San Isidro", "ARG", 306341)); + cities.put(90, new City(90, "Tigre", "ARG", 296226)); + cities.put(91, new City(91, "Malvinas Argentinas", "ARG", 290335)); + cities.put(92, new City(92, "Vicente L¢pez", "ARG", 288341)); + cities.put(93, new City(93, "Berazategui", "ARG", 276916)); + cities.put(94, new City(94, "Corrientes", "ARG", 258103)); + cities.put(95, new City(95, "San Miguel", "ARG", 248700)); + cities.put(96, new City(96, "Bah¡a Blanca", "ARG", 239810)); + cities.put(97, new City(97, "Esteban Echeverr¡a", "ARG", 235760)); + cities.put(98, new City(98, "Resistencia", "ARG", 229212)); + cities.put(99, new City(99, "Jos‚ C. Paz", "ARG", 221754)); + cities.put(100, new City(100, "Paran ", "ARG", 207041)); + cities.put(101, new City(101, "Godoy Cruz", "ARG", 206998)); + cities.put(102, new City(102, "Posadas", "ARG", 201273)); + cities.put(103, new City(103, "Guaymall‚n", "ARG", 200595)); + cities.put(104, new City(104, "Santiago del Estero", "ARG", 189947)); + cities.put(105, new City(105, "San Salvador de Jujuy", "ARG", 178748)); + cities.put(106, new City(106, "Hurlingham", "ARG", 170028)); + cities.put(107, new City(107, "Neuqu‚n", "ARG", 167296)); + cities.put(108, new City(108, "Ituzaing¢", "ARG", 158197)); + cities.put(109, new City(109, "San Fernando", "ARG", 153036)); + cities.put(110, new City(110, "Formosa", "ARG", 147636)); + cities.put(111, new City(111, "Las Heras", "ARG", 145823)); + cities.put(112, new City(112, "La Rioja", "ARG", 138117)); + cities.put(113, new City(113, "San Fernando del Valle de Cata", "ARG", + 134935)); + cities.put(114, new City(114, "R¡o Cuarto", "ARG", 134355)); + cities.put(115, new City(115, "Comodoro Rivadavia", "ARG", 124104)); + cities.put(116, new City(116, "Mendoza", "ARG", 123027)); + cities.put(117, new City(117, "San Nicol s de los Arroyos", "ARG", + 119302)); + cities.put(118, new City(118, "San Juan", "ARG", 119152)); + cities.put(119, new City(119, "Escobar", "ARG", 116675)); + cities.put(120, new City(120, "Concordia", "ARG", 116485)); + cities.put(121, new City(121, "Pilar", "ARG", 113428)); + cities.put(122, new City(122, "San Luis", "ARG", 110136)); + cities.put(123, new City(123, "Ezeiza", "ARG", 99578)); + cities.put(124, new City(124, "San Rafael", "ARG", 94651)); + cities.put(125, new City(125, "Tandil", "ARG", 91101)); + cities.put(126, new City(126, "Yerevan", "ARM", 1248700)); + cities.put(127, new City(127, "Gjumri", "ARM", 211700)); + cities.put(128, new City(128, "Vanadzor", "ARM", 172700)); + cities.put(129, new City(129, "Oranjestad", "ABW", 29034)); + cities.put(130, new City(130, "Sydney", "AUS", 3276207)); + cities.put(131, new City(131, "Melbourne", "AUS", 2865329)); + cities.put(132, new City(132, "Brisbane", "AUS", 1291117)); + cities.put(133, new City(133, "Perth", "AUS", 1096829)); + cities.put(134, new City(134, "Adelaide", "AUS", 978100)); + cities.put(135, new City(135, "Canberra", "AUS", 322723)); + cities.put(136, new City(136, "Gold Coast", "AUS", 311932)); + cities.put(137, new City(137, "Newcastle", "AUS", 270324)); + cities.put(138, new City(138, "Central Coast", "AUS", 227657)); + cities.put(139, new City(139, "Wollongong", "AUS", 219761)); + cities.put(140, new City(140, "Hobart", "AUS", 126118)); + cities.put(141, new City(141, "Geelong", "AUS", 125382)); + cities.put(142, new City(142, "Townsville", "AUS", 109914)); + cities.put(143, new City(143, "Cairns", "AUS", 92273)); + cities.put(144, new City(144, "Baku", "AZE", 1787800)); + cities.put(145, new City(145, "G„nc„", "AZE", 299300)); + cities.put(146, new City(146, "Sumqayit", "AZE", 283000)); + cities.put(147, new City(147, "Ming„‡evir", "AZE", 93900)); + cities.put(148, new City(148, "Nassau", "BHS", 172000)); + cities.put(149, new City(149, "al-Manama", "BHR", 148000)); + cities.put(150, new City(150, "Dhaka", "BGD", 3612850)); + cities.put(151, new City(151, "Chittagong", "BGD", 1392860)); + cities.put(152, new City(152, "Khulna", "BGD", 663340)); + cities.put(153, new City(153, "Rajshahi", "BGD", 294056)); + cities.put(154, new City(154, "Narayanganj", "BGD", 202134)); + cities.put(155, new City(155, "Rangpur", "BGD", 191398)); + cities.put(156, new City(156, "Mymensingh", "BGD", 188713)); + cities.put(157, new City(157, "Barisal", "BGD", 170232)); + cities.put(158, new City(158, "Tungi", "BGD", 168702)); + cities.put(159, new City(159, "Jessore", "BGD", 139710)); + cities.put(160, new City(160, "Comilla", "BGD", 135313)); + cities.put(161, new City(161, "Nawabganj", "BGD", 130577)); + cities.put(162, new City(162, "Dinajpur", "BGD", 127815)); + cities.put(163, new City(163, "Bogra", "BGD", 120170)); + cities.put(164, new City(164, "Sylhet", "BGD", 117396)); + cities.put(165, new City(165, "Brahmanbaria", "BGD", 109032)); + cities.put(166, new City(166, "Tangail", "BGD", 106004)); + cities.put(167, new City(167, "Jamalpur", "BGD", 103556)); + cities.put(168, new City(168, "Pabna", "BGD", 103277)); + cities.put(169, new City(169, "Naogaon", "BGD", 101266)); + cities.put(170, new City(170, "Sirajganj", "BGD", 99669)); + cities.put(171, new City(171, "Narsinghdi", "BGD", 98342)); + cities.put(172, new City(172, "Saidpur", "BGD", 96777)); + cities.put(173, new City(173, "Gazipur", "BGD", 96717)); + cities.put(174, new City(174, "Bridgetown", "BRB", 6070)); + cities.put(175, new City(175, "Antwerpen", "BEL", 446525)); + cities.put(176, new City(176, "Gent", "BEL", 224180)); + cities.put(177, new City(177, "Charleroi", "BEL", 200827)); + cities.put(178, new City(178, "LiÅ ge", "BEL", 185639)); + cities.put(179, new City(179, "Bruxelles [Brussel]", "BEL", 133859)); + cities.put(180, new City(180, "Brugge", "BEL", 116246)); + cities.put(181, new City(181, "Schaerbeek", "BEL", 105692)); + cities.put(182, new City(182, "Namur", "BEL", 105419)); + cities.put(183, new City(183, "Mons", "BEL", 90935)); + cities.put(184, new City(184, "Belize City", "BLZ", 55810)); + cities.put(185, new City(185, "Belmopan", "BLZ", 7105)); + cities.put(186, new City(186, "Cotonou", "BEN", 536827)); + cities.put(187, new City(187, "Porto-Novo", "BEN", 194000)); + cities.put(188, new City(188, "Djougou", "BEN", 134099)); + cities.put(189, new City(189, "Parakou", "BEN", 103577)); + cities.put(190, new City(190, "Saint George", "BMU", 1800)); + cities.put(191, new City(191, "Hamilton", "BMU", 1200)); + cities.put(192, new City(192, "Thimphu", "BTN", 22000)); + cities.put(193, new City(193, "Santa Cruz de la Sierra", "BOL", 935361)); + cities.put(194, new City(194, "La Paz", "BOL", 758141)); + cities.put(195, new City(195, "El Alto", "BOL", 534466)); + cities.put(196, new City(196, "Cochabamba", "BOL", 482800)); + cities.put(197, new City(197, "Oruro", "BOL", 223553)); + cities.put(198, new City(198, "Sucre", "BOL", 178426)); + cities.put(199, new City(199, "Potos¡", "BOL", 140642)); + cities.put(200, new City(200, "Tarija", "BOL", 125255)); + cities.put(201, new City(201, "Sarajevo", "BIH", 360000)); + cities.put(202, new City(202, "Banja Luka", "BIH", 143079)); + cities.put(203, new City(203, "Zenica", "BIH", 96027)); + cities.put(204, new City(204, "Gaborone", "BWA", 213017)); + cities.put(205, new City(205, "Francistown", "BWA", 101805)); + cities.put(206, new City(206, "SÆo Paulo", "BRA", 9968485)); + cities.put(207, new City(207, "Rio de Janeiro", "BRA", 5598953)); + cities.put(208, new City(208, "Salvador", "BRA", 2302832)); + cities.put(209, new City(209, "Belo Horizonte", "BRA", 2139125)); + cities.put(210, new City(210, "Fortaleza", "BRA", 2097757)); + cities.put(211, new City(211, "Bras¡lia", "BRA", 1969868)); + cities.put(212, new City(212, "Curitiba", "BRA", 1584232)); + cities.put(213, new City(213, "Recife", "BRA", 1378087)); + cities.put(214, new City(214, "Porto Alegre", "BRA", 1314032)); + cities.put(215, new City(215, "Manaus", "BRA", 1255049)); + cities.put(216, new City(216, "Bel‚m", "BRA", 1186926)); + cities.put(217, new City(217, "Guarulhos", "BRA", 1095874)); + cities.put(218, new City(218, "GoiÆ’nia", "BRA", 1056330)); + cities.put(219, new City(219, "Campinas", "BRA", 950043)); + cities.put(220, new City(220, "SÆo Gon‡alo", "BRA", 869254)); + cities.put(221, new City(221, "Nova Igua‡u", "BRA", 862225)); + cities.put(222, new City(222, "SÆo Lu¡s", "BRA", 837588)); + cities.put(223, new City(223, "Macei¢", "BRA", 786288)); + cities.put(224, new City(224, "Duque de Caxias", "BRA", 746758)); + cities.put(225, new City(225, "SÆo Bernardo do Campo", "BRA", + 723132)); + cities.put(226, new City(226, "Teresina", "BRA", 691942)); + cities.put(227, new City(227, "Natal", "BRA", 688955)); + cities.put(228, new City(228, "Osasco", "BRA", 659604)); + cities.put(229, new City(229, "Campo Grande", "BRA", 649593)); + cities.put(230, new City(230, "Santo Andr‚", "BRA", 630073)); + cities.put(231, new City(231, "JoÆo Pessoa", "BRA", 584029)); + cities.put(232, new City(232, "JaboatÆo dos Guararapes", "BRA", + 558680)); + cities.put(233, new City(233, "Contagem", "BRA", 520801)); + cities.put(234, new City(234, "SÆo Jos‚ dos Campos", "BRA", + 515553)); + cities.put(235, new City(235, "UberlÆ’ndia", "BRA", 487222)); + cities.put(236, new City(236, "Feira de Santana", "BRA", 479992)); + cities.put(237, new City(237, "RibeirÆo Preto", "BRA", 473276)); + cities.put(238, new City(238, "Sorocaba", "BRA", 466823)); + cities.put(239, new City(239, "Niter¢i", "BRA", 459884)); + cities.put(240, new City(240, "Cuiab ", "BRA", 453813)); + cities.put(241, new City(241, "Juiz de Fora", "BRA", 450288)); + cities.put(242, new City(242, "Aracaju", "BRA", 445555)); + cities.put(243, new City(243, "SÆo JoÆo de Meriti", "BRA", + 440052)); + cities.put(244, new City(244, "Londrina", "BRA", 432257)); + cities.put(245, new City(245, "Joinville", "BRA", 428011)); + cities.put(246, new City(246, "Belford Roxo", "BRA", 425194)); + cities.put(247, new City(247, "Santos", "BRA", 408748)); + cities.put(248, new City(248, "Ananindeua", "BRA", 400940)); + cities.put(249, new City(249, "Campos dos Goytacazes", "BRA", 398418)); + cities.put(250, new City(250, "Mau ", "BRA", 375055)); + cities.put(251, new City(251, "Carapicu¡ba", "BRA", 357552)); + cities.put(252, new City(252, "Olinda", "BRA", 354732)); + cities.put(253, new City(253, "Campina Grande", "BRA", 352497)); + cities.put(254, new City(254, "SÆo Jos‚ do Rio Preto", "BRA", + 351944)); + cities.put(255, new City(255, "Caxias do Sul", "BRA", 349581)); + cities.put(256, new City(256, "Moji das Cruzes", "BRA", 339194)); + cities.put(257, new City(257, "Diadema", "BRA", 335078)); + cities.put(258, + new City(258, "Aparecida de GoiÆ’nia", "BRA", 324662)); + cities.put(259, new City(259, "Piracicaba", "BRA", 319104)); + cities.put(260, new City(260, "Cariacica", "BRA", 319033)); + cities.put(261, new City(261, "Vila Velha", "BRA", 318758)); + cities.put(262, new City(262, "Pelotas", "BRA", 315415)); + cities.put(263, new City(263, "Bauru", "BRA", 313670)); + cities.put(264, new City(264, "Porto Velho", "BRA", 309750)); + cities.put(265, new City(265, "Serra", "BRA", 302666)); + cities.put(266, new City(266, "Betim", "BRA", 302108)); + cities.put(267, new City(267, "Jund¡a¡", "BRA", 296127)); + cities.put(268, new City(268, "Canoas", "BRA", 294125)); + cities.put(269, new City(269, "Franca", "BRA", 290139)); + cities.put(270, new City(270, "SÆo Vicente", "BRA", 286848)); + cities.put(271, new City(271, "Maring ", "BRA", 286461)); + cities.put(272, new City(272, "Montes Claros", "BRA", 286058)); + cities.put(273, new City(273, "An polis", "BRA", 282197)); + cities.put(274, new City(274, "Florian¢polis", "BRA", 281928)); + cities.put(275, new City(275, "Petr¢polis", "BRA", 279183)); + cities.put(276, new City(276, "Itaquaquecetuba", "BRA", 270874)); + cities.put(277, new City(277, "Vit¢ria", "BRA", 270626)); + cities.put(278, new City(278, "Ponta Grossa", "BRA", 268013)); + cities.put(279, new City(279, "Rio Branco", "BRA", 259537)); + cities.put(280, new City(280, "Foz do Igua‡u", "BRA", 259425)); + cities.put(281, new City(281, "Macap ", "BRA", 256033)); + cities.put(282, new City(282, "Ilh‚us", "BRA", 254970)); + cities.put(283, new City(283, "Vit¢ria da Conquista", "BRA", 253587)); + cities.put(284, new City(284, "Uberaba", "BRA", 249225)); + cities.put(285, new City(285, "Paulista", "BRA", 248473)); + cities.put(286, new City(286, "Limeira", "BRA", 245497)); + cities.put(287, new City(287, "Blumenau", "BRA", 244379)); + cities.put(288, new City(288, "Caruaru", "BRA", 244247)); + cities.put(289, new City(289, "Santar‚m", "BRA", 241771)); + cities.put(290, new City(290, "Volta Redonda", "BRA", 240315)); + cities.put(291, new City(291, "Novo Hamburgo", "BRA", 239940)); + cities.put(292, new City(292, "Caucaia", "BRA", 238738)); + cities.put(293, new City(293, "Santa Maria", "BRA", 238473)); + cities.put(294, new City(294, "Cascavel", "BRA", 237510)); + cities.put(295, new City(295, "Guaruj ", "BRA", 237206)); + cities.put(296, new City(296, "RibeirÆo das Neves", "BRA", 232685)); + cities.put(297, new City(297, "Governador Valadares", "BRA", 231724)); + cities.put(298, new City(298, "Taubat‚", "BRA", 229130)); + cities.put(299, new City(299, "Imperatriz", "BRA", 224564)); + cities.put(300, new City(300, "Gravata¡", "BRA", 223011)); + cities.put(301, new City(301, "Embu", "BRA", 222223)); + cities.put(302, new City(302, "Mossor¢", "BRA", 214901)); + cities.put(303, new City(303, "V rzea Grande", "BRA", 214435)); + cities.put(304, new City(304, "Petrolina", "BRA", 210540)); + cities.put(305, new City(305, "Barueri", "BRA", 208426)); + cities.put(306, new City(306, "ViamÆo", "BRA", 207557)); + cities.put(307, new City(307, "Ipatinga", "BRA", 206338)); + cities.put(308, new City(308, "Juazeiro", "BRA", 201073)); + cities.put(309, new City(309, "Juazeiro do Norte", "BRA", 199636)); + cities.put(310, new City(310, "TaboÆo da Serra", "BRA", 197550)); + cities.put(311, new City(311, "SÆo Jos‚ dos Pinhais", "BRA", + 196884)); + cities.put(312, new City(312, "Mag‚", "BRA", 196147)); + cities.put(313, new City(313, "Suzano", "BRA", 195434)); + cities.put(314, new City(314, "SÆo Leopoldo", "BRA", 189258)); + cities.put(315, new City(315, "Mar¡lia", "BRA", 188691)); + cities.put(316, new City(316, "SÆo Carlos", "BRA", 187122)); + cities.put(317, new City(317, "Sumar‚", "BRA", 186205)); + cities.put(318, new City(318, "Presidente Prudente", "BRA", 185340)); + cities.put(319, new City(319, "Divin¢polis", "BRA", 185047)); + cities.put(320, new City(320, "Sete Lagoas", "BRA", 182984)); + cities.put(321, new City(321, "Rio Grande", "BRA", 182222)); + cities.put(322, new City(322, "Itabuna", "BRA", 182148)); + cities.put(323, new City(323, "Jequi‚", "BRA", 179128)); + cities.put(324, new City(324, "Arapiraca", "BRA", 178988)); + cities.put(325, new City(325, "Colombo", "BRA", 177764)); + cities.put(326, new City(326, "Americana", "BRA", 177409)); + cities.put(327, new City(327, "Alvorada", "BRA", 175574)); + cities.put(328, new City(328, "Araraquara", "BRA", 174381)); + cities.put(329, new City(329, "Itabora¡", "BRA", 173977)); + cities.put(330, new City(330, "Santa B rbara dïOeste", "BRA", + 171657)); + cities.put(331, new City(331, "Nova Friburgo", "BRA", 170697)); + cities.put(332, new City(332, "Jacare¡", "BRA", 170356)); + cities.put(333, new City(333, "Ara‡atuba", "BRA", 169303)); + cities.put(334, new City(334, "Barra Mansa", "BRA", 168953)); + cities.put(335, new City(335, "Praia Grande", "BRA", 168434)); + cities.put(336, new City(336, "Marab ", "BRA", 167795)); + cities.put(337, new City(337, "Crici£ma", "BRA", 167661)); + cities.put(338, new City(338, "Boa Vista", "BRA", 167185)); + cities.put(339, new City(339, "Passo Fundo", "BRA", 166343)); + cities.put(340, new City(340, "Dourados", "BRA", 164716)); + cities.put(341, new City(341, "Santa Luzia", "BRA", 164704)); + cities.put(342, new City(342, "Rio Claro", "BRA", 163551)); + cities.put(343, new City(343, "Maracana£", "BRA", 162022)); + cities.put(344, new City(344, "Guarapuava", "BRA", 160510)); + cities.put(345, new City(345, "Rondon¢polis", "BRA", 155115)); + cities.put(346, new City(346, "SÆo Jos‚", "BRA", 155105)); + cities.put(347, new City(347, "Cachoeiro de Itapemirim", "BRA", 155024)); + cities.put(348, new City(348, "Nil¢polis", "BRA", 153383)); + cities.put(349, new City(349, "Itapevi", "BRA", 150664)); + cities.put(350, new City(350, "Cabo de Santo Agostinho", "BRA", 149964)); + cities.put(351, new City(351, "Cama‡ari", "BRA", 149146)); + cities.put(352, new City(352, "Sobral", "BRA", 146005)); + cities.put(353, new City(353, "Itaja¡", "BRA", 145197)); + cities.put(354, new City(354, "Chapec¢", "BRA", 144158)); + cities.put(355, new City(355, "Cotia", "BRA", 140042)); + cities.put(356, new City(356, "Lages", "BRA", 139570)); + cities.put(357, new City(357, "Ferraz de Vasconcelos", "BRA", 139283)); + cities.put(358, new City(358, "Indaiatuba", "BRA", 135968)); + cities.put(359, new City(359, "HortolÆ’ndia", "BRA", 135755)); + cities.put(360, new City(360, "Caxias", "BRA", 133980)); + cities.put(361, new City(361, "SÆo Caetano do Sul", "BRA", 133321)); + cities.put(362, new City(362, "Itu", "BRA", 132736)); + cities.put(363, + new City(363, "Nossa Senhora do Socorro", "BRA", 131351)); + cities.put(364, new City(364, "Parna¡ba", "BRA", 129756)); + cities.put(365, new City(365, "Po‡os de Caldas", "BRA", 129683)); + cities.put(366, new City(366, "Teres¢polis", "BRA", 128079)); + cities.put(367, new City(367, "Barreiras", "BRA", 127801)); + cities.put(368, new City(368, "Castanhal", "BRA", 127634)); + cities.put(369, new City(369, "Alagoinhas", "BRA", 126820)); + cities.put(370, new City(370, "Itapecerica da Serra", "BRA", 126672)); + cities.put(371, new City(371, "Uruguaiana", "BRA", 126305)); + cities.put(372, new City(372, "Paranagu ", "BRA", 126076)); + cities.put(373, new City(373, "Ibirit‚", "BRA", 125982)); + cities.put(374, new City(374, "Timon", "BRA", 125812)); + cities.put(375, new City(375, "LuziÆ’nia", "BRA", 125597)); + cities.put(376, new City(376, "Maca‚", "BRA", 125597)); + cities.put(377, new City(377, "Te¢filo Otoni", "BRA", 124489)); + cities.put(378, new City(378, "Moji-Gua‡u", "BRA", 123782)); + cities.put(379, new City(379, "Palmas", "BRA", 121919)); + cities.put(380, new City(380, "Pindamonhangaba", "BRA", 121904)); + cities.put(381, new City(381, "Francisco Morato", "BRA", 121197)); + cities.put(382, new City(382, "Bag‚", "BRA", 120793)); + cities.put(383, new City(383, "Sapucaia do Sul", "BRA", 120217)); + cities.put(384, new City(384, "Cabo Frio", "BRA", 119503)); + cities.put(385, new City(385, "Itapetininga", "BRA", 119391)); + cities.put(386, new City(386, "Patos de Minas", "BRA", 119262)); + cities.put(387, new City(387, "Camaragibe", "BRA", 118968)); + cities.put(388, new City(388, "Bragan‡a Paulista", "BRA", 116929)); + cities.put(389, new City(389, "Queimados", "BRA", 115020)); + cities.put(390, new City(390, "Aragua¡na", "BRA", 114948)); + cities.put(391, new City(391, "Garanhuns", "BRA", 114603)); + cities.put(392, new City(392, "Vit¢ria de Santo AntÆo", "BRA", + 113595)); + cities.put(393, new City(393, "Santa Rita", "BRA", 113135)); + cities.put(394, new City(394, "Barbacena", "BRA", 113079)); + cities.put(395, new City(395, "Abaetetuba", "BRA", 111258)); + cities.put(396, new City(396, "Ja£", "BRA", 109965)); + cities.put(397, new City(397, "Lauro de Freitas", "BRA", 109236)); + cities.put(398, new City(398, "Franco da Rocha", "BRA", 108964)); + cities.put(399, new City(399, "Teixeira de Freitas", "BRA", 108441)); + cities.put(400, new City(400, "Varginha", "BRA", 108314)); + cities.put(401, new City(401, "RibeirÆo Pires", "BRA", 108121)); + cities.put(402, new City(402, "Sabar ", "BRA", 107781)); + cities.put(403, new City(403, "Catanduva", "BRA", 107761)); + cities.put(404, new City(404, "Rio Verde", "BRA", 107755)); + cities.put(405, new City(405, "Botucatu", "BRA", 107663)); + cities.put(406, new City(406, "Colatina", "BRA", 107354)); + cities.put(407, new City(407, "Santa Cruz do Sul", "BRA", 106734)); + cities.put(408, new City(408, "Linhares", "BRA", 106278)); + cities.put(409, new City(409, "Apucarana", "BRA", 105114)); + cities.put(410, new City(410, "Barretos", "BRA", 104156)); + cities.put(411, new City(411, "Guaratinguet ", "BRA", 103433)); + cities.put(412, new City(412, "Cachoeirinha", "BRA", 103240)); + cities.put(413, new City(413, "Cod¢", "BRA", 103153)); + cities.put(414, new City(414, "Jaragu  do Sul", "BRA", 102580)); + cities.put(415, new City(415, "CubatÆo", "BRA", 102372)); + cities.put(416, new City(416, "Itabira", "BRA", 102217)); + cities.put(417, new City(417, "Itaituba", "BRA", 101320)); + cities.put(418, new City(418, "Araras", "BRA", 101046)); + cities.put(419, new City(419, "Resende", "BRA", 100627)); + cities.put(420, new City(420, "Atibaia", "BRA", 100356)); + cities.put(421, new City(421, "Pouso Alegre", "BRA", 100028)); + cities.put(422, new City(422, "Toledo", "BRA", 99387)); + cities.put(423, new City(423, "Crato", "BRA", 98965)); + cities.put(424, new City(424, "Passos", "BRA", 98570)); + cities.put(425, new City(425, "Araguari", "BRA", 98399)); + cities.put(426, new City(426, "SÆo Jos‚ de Ribamar", "BRA", + 98318)); + cities.put(427, new City(427, "Pinhais", "BRA", 98198)); + cities.put(428, new City(428, "SertÆozinho", "BRA", 98140)); + cities.put(429, new City(429, "Conselheiro Lafaiete", "BRA", 97507)); + cities.put(430, new City(430, "Paulo Afonso", "BRA", 97291)); + cities.put(431, new City(431, "Angra dos Reis", "BRA", 96864)); + cities.put(432, new City(432, "Eun polis", "BRA", 96610)); + cities.put(433, new City(433, "Salto", "BRA", 96348)); + cities.put(434, new City(434, "Ourinhos", "BRA", 96291)); + cities.put(435, new City(435, "Parnamirim", "BRA", 96210)); + cities.put(436, new City(436, "Jacobina", "BRA", 96131)); + cities.put(437, new City(437, "Coronel Fabriciano", "BRA", 95933)); + cities.put(438, new City(438, "Birigui", "BRA", 94685)); + cities.put(439, new City(439, "Tatu¡", "BRA", 93897)); + cities.put(440, new City(440, "Ji-Paran ", "BRA", 93346)); + cities.put(441, new City(441, "Bacabal", "BRA", 93121)); + cities.put(442, new City(442, "Camet ", "BRA", 92779)); + cities.put(443, new City(443, "Gua¡ba", "BRA", 92224)); + cities.put(444, new City(444, "SÆo Louren‡o da Mata", "BRA", + 91999)); + cities.put(445, new City(445, "Santana do Livramento", "BRA", 91779)); + cities.put(446, new City(446, "Votorantim", "BRA", 91777)); + cities.put(447, new City(447, "Campo Largo", "BRA", 91203)); + cities.put(448, new City(448, "Patos", "BRA", 90519)); + cities.put(449, new City(449, "Ituiutaba", "BRA", 90507)); + cities.put(450, new City(450, "Corumb ", "BRA", 90111)); + cities.put(451, new City(451, "Palho‡a", "BRA", 89465)); + cities.put(452, new City(452, "Barra do Pira¡", "BRA", 89388)); + cities.put(453, new City(453, "Bento Gon‡alves", "BRA", 89254)); + cities.put(454, new City(454, "Po ", "BRA", 89236)); + cities.put(455, new City(455, "µguas Lindas de Goi s", "BRA", + 89200)); + cities.put(456, new City(456, "London", "GBR", 7285000)); + cities.put(457, new City(457, "Birmingham", "GBR", 1013000)); + cities.put(458, new City(458, "Glasgow", "GBR", 619680)); + cities.put(459, new City(459, "Liverpool", "GBR", 461000)); + cities.put(460, new City(460, "Edinburgh", "GBR", 450180)); + cities.put(461, new City(461, "Sheffield", "GBR", 431607)); + cities.put(462, new City(462, "Manchester", "GBR", 430000)); + cities.put(463, new City(463, "Leeds", "GBR", 424194)); + cities.put(464, new City(464, "Bristol", "GBR", 402000)); + cities.put(465, new City(465, "Cardiff", "GBR", 321000)); + cities.put(466, new City(466, "Coventry", "GBR", 304000)); + cities.put(467, new City(467, "Leicester", "GBR", 294000)); + cities.put(468, new City(468, "Bradford", "GBR", 289376)); + cities.put(469, new City(469, "Belfast", "GBR", 287500)); + cities.put(470, new City(470, "Nottingham", "GBR", 287000)); + cities.put(471, new City(471, "Kingston upon Hull", "GBR", 262000)); + cities.put(472, new City(472, "Plymouth", "GBR", 253000)); + cities.put(473, new City(473, "Stoke-on-Trent", "GBR", 252000)); + cities.put(474, new City(474, "Wolverhampton", "GBR", 242000)); + cities.put(475, new City(475, "Derby", "GBR", 236000)); + cities.put(476, new City(476, "Swansea", "GBR", 230000)); + cities.put(477, new City(477, "Southampton", "GBR", 216000)); + cities.put(478, new City(478, "Aberdeen", "GBR", 213070)); + cities.put(479, new City(479, "Northampton", "GBR", 196000)); + cities.put(480, new City(480, "Dudley", "GBR", 192171)); + cities.put(481, new City(481, "Portsmouth", "GBR", 190000)); + cities.put(482, new City(482, "Newcastle upon Tyne", "GBR", 189150)); + cities.put(483, new City(483, "Sunderland", "GBR", 183310)); + cities.put(484, new City(484, "Luton", "GBR", 183000)); + cities.put(485, new City(485, "Swindon", "GBR", 180000)); + cities.put(486, new City(486, "Southend-on-Sea", "GBR", 176000)); + cities.put(487, new City(487, "Walsall", "GBR", 174739)); + cities.put(488, new City(488, "Bournemouth", "GBR", 162000)); + cities.put(489, new City(489, "Peterborough", "GBR", 156000)); + cities.put(490, new City(490, "Brighton", "GBR", 156124)); + cities.put(491, new City(491, "Blackpool", "GBR", 151000)); + cities.put(492, new City(492, "Dundee", "GBR", 146690)); + cities.put(493, new City(493, "West Bromwich", "GBR", 146386)); + cities.put(494, new City(494, "Reading", "GBR", 148000)); + cities.put(495, new City(495, "Oldbury/Smethwick (Warley)", "GBR", + 145542)); + cities.put(496, new City(496, "Middlesbrough", "GBR", 145000)); + cities.put(497, new City(497, "Huddersfield", "GBR", 143726)); + cities.put(498, new City(498, "Oxford", "GBR", 144000)); + cities.put(499, new City(499, "Poole", "GBR", 141000)); + cities.put(500, new City(500, "Bolton", "GBR", 139020)); + cities.put(501, new City(501, "Blackburn", "GBR", 140000)); + cities.put(502, new City(502, "Newport", "GBR", 139000)); + cities.put(503, new City(503, "Preston", "GBR", 135000)); + cities.put(504, new City(504, "Stockport", "GBR", 132813)); + cities.put(505, new City(505, "Norwich", "GBR", 124000)); + cities.put(506, new City(506, "Rotherham", "GBR", 121380)); + cities.put(507, new City(507, "Cambridge", "GBR", 121000)); + cities.put(508, new City(508, "Watford", "GBR", 113080)); + cities.put(509, new City(509, "Ipswich", "GBR", 114000)); + cities.put(510, new City(510, "Slough", "GBR", 112000)); + cities.put(511, new City(511, "Exeter", "GBR", 111000)); + cities.put(512, new City(512, "Cheltenham", "GBR", 106000)); + cities.put(513, new City(513, "Gloucester", "GBR", 107000)); + cities.put(514, new City(514, "Saint Helens", "GBR", 106293)); + cities.put(515, new City(515, "Sutton Coldfield", "GBR", 106001)); + cities.put(516, new City(516, "York", "GBR", 104425)); + cities.put(517, new City(517, "Oldham", "GBR", 103931)); + cities.put(518, new City(518, "Basildon", "GBR", 100924)); + cities.put(519, new City(519, "Worthing", "GBR", 100000)); + cities.put(520, new City(520, "Chelmsford", "GBR", 97451)); + cities.put(521, new City(521, "Colchester", "GBR", 96063)); + cities.put(522, new City(522, "Crawley", "GBR", 97000)); + cities.put(523, new City(523, "Gillingham", "GBR", 92000)); + cities.put(524, new City(524, "Solihull", "GBR", 94531)); + cities.put(525, new City(525, "Rochdale", "GBR", 94313)); + cities.put(526, new City(526, "Birkenhead", "GBR", 93087)); + cities.put(527, new City(527, "Worcester", "GBR", 95000)); + cities.put(528, new City(528, "Hartlepool", "GBR", 92000)); + cities.put(529, new City(529, "Halifax", "GBR", 91069)); + cities.put(530, new City(530, "Woking/Byfleet", "GBR", 92000)); + cities.put(531, new City(531, "Southport", "GBR", 90959)); + cities.put(532, new City(532, "Maidstone", "GBR", 90878)); + cities.put(533, new City(533, "Eastbourne", "GBR", 90000)); + cities.put(534, new City(534, "Grimsby", "GBR", 89000)); + cities.put(535, new City(535, "Saint Helier", "GBR", 27523)); + cities.put(536, new City(536, "Douglas", "GBR", 23487)); + cities.put(537, new City(537, "Road Town", "VGB", 8000)); + cities.put(538, new City(538, "Bandar Seri Begawan", "BRN", 21484)); + cities.put(539, new City(539, "Sofija", "BGR", 1122302)); + cities.put(540, new City(540, "Plovdiv", "BGR", 342584)); + cities.put(541, new City(541, "Varna", "BGR", 299801)); + cities.put(542, new City(542, "Burgas", "BGR", 195255)); + cities.put(543, new City(543, "Ruse", "BGR", 166467)); + cities.put(544, new City(544, "Stara Zagora", "BGR", 147939)); + cities.put(545, new City(545, "Pleven", "BGR", 121952)); + cities.put(546, new City(546, "Sliven", "BGR", 105530)); + cities.put(547, new City(547, "Dobric", "BGR", 100399)); + cities.put(548, new City(548, "?umen", "BGR", 94686)); + cities.put(549, new City(549, "Ouagadougou", "BFA", 824000)); + cities.put(550, new City(550, "Bobo-Dioulasso", "BFA", 300000)); + cities.put(551, new City(551, "Koudougou", "BFA", 105000)); + cities.put(552, new City(552, "Bujumbura", "BDI", 300000)); + cities.put(553, new City(553, "George Town", "CYM", 19600)); + cities.put(554, new City(554, "Santiago de Chile", "CHL", 4703954)); + cities.put(555, new City(555, "Puente Alto", "CHL", 386236)); + cities.put(556, new City(556, "Vi¤a del Mar", "CHL", 312493)); + cities.put(557, new City(557, "Valpara¡so", "CHL", 293800)); + cities.put(558, new City(558, "Talcahuano", "CHL", 277752)); + cities.put(559, new City(559, "Antofagasta", "CHL", 251429)); + cities.put(560, new City(560, "San Bernardo", "CHL", 241910)); + cities.put(561, new City(561, "Temuco", "CHL", 233041)); + cities.put(562, new City(562, "Concepci¢n", "CHL", 217664)); + cities.put(563, new City(563, "Rancagua", "CHL", 212977)); + cities.put(564, new City(564, "Arica", "CHL", 189036)); + cities.put(565, new City(565, "Talca", "CHL", 187557)); + cities.put(566, new City(566, "Chill n", "CHL", 178182)); + cities.put(567, new City(567, "Iquique", "CHL", 177892)); + cities.put(568, new City(568, "Los Angeles", "CHL", 158215)); + cities.put(569, new City(569, "Puerto Montt", "CHL", 152194)); + cities.put(570, new City(570, "Coquimbo", "CHL", 143353)); + cities.put(571, new City(571, "Osorno", "CHL", 141468)); + cities.put(572, new City(572, "La Serena", "CHL", 137409)); + cities.put(573, new City(573, "Calama", "CHL", 137265)); + cities.put(574, new City(574, "Valdivia", "CHL", 133106)); + cities.put(575, new City(575, "Punta Arenas", "CHL", 125631)); + cities.put(576, new City(576, "Copiap¢", "CHL", 120128)); + cities.put(577, new City(577, "Quilpu‚", "CHL", 118857)); + cities.put(578, new City(578, "Curic¢", "CHL", 115766)); + cities.put(579, new City(579, "Ovalle", "CHL", 94854)); + cities.put(580, new City(580, "Coronel", "CHL", 93061)); + cities.put(581, new City(581, "San Pedro de la Paz", "CHL", 91684)); + cities.put(582, new City(582, "Melipilla", "CHL", 91056)); + cities.put(583, new City(583, "Avarua", "COK", 11900)); + cities.put(584, new City(584, "San Jos‚", "CRI", 339131)); + cities.put(585, new City(585, "Djibouti", "DJI", 383000)); + cities.put(586, new City(586, "Roseau", "DMA", 16243)); + cities.put(587, new City(587, "Santo Domingo de Guzm n", "DOM", + 1609966)); + cities.put(588, new City(588, "Santiago de los Caballeros", "DOM", + 365463)); + cities.put(589, new City(589, "La Romana", "DOM", 140204)); + cities.put(590, new City(590, "San Pedro de Macor¡s", "DOM", 124735)); + cities.put(591, new City(591, "San Francisco de Macor¡s", "DOM", + 108485)); + cities.put(592, new City(592, "San Felipe de Puerto Plata", "DOM", + 89423)); + cities.put(593, new City(593, "Guayaquil", "ECU", 2070040)); + cities.put(594, new City(594, "Quito", "ECU", 1573458)); + cities.put(595, new City(595, "Cuenca", "ECU", 270353)); + cities.put(596, new City(596, "Machala", "ECU", 210368)); + cities.put(597, new City(597, "Santo Domingo de los Colorados", "ECU", + 202111)); + cities.put(598, new City(598, "Portoviejo", "ECU", 176413)); + cities.put(599, new City(599, "Ambato", "ECU", 169612)); + cities.put(600, new City(600, "Manta", "ECU", 164739)); + cities.put(601, new City(601, "Duran [Eloy Alfaro]", "ECU", 152514)); + cities.put(602, new City(602, "Ibarra", "ECU", 130643)); + cities.put(603, new City(603, "Quevedo", "ECU", 129631)); + cities.put(604, new City(604, "Milagro", "ECU", 124177)); + cities.put(605, new City(605, "Loja", "ECU", 123875)); + cities.put(606, new City(606, "R¡obamba", "ECU", 123163)); + cities.put(607, new City(607, "Esmeraldas", "ECU", 123045)); + cities.put(608, new City(608, "Cairo", "EGY", 6789479)); + cities.put(609, new City(609, "Alexandria", "EGY", 3328196)); + cities.put(610, new City(610, "Giza", "EGY", 2221868)); + cities.put(611, new City(611, "Shubra al-Khayma", "EGY", 870716)); + cities.put(612, new City(612, "Port Said", "EGY", 469533)); + cities.put(613, new City(613, "Suez", "EGY", 417610)); + cities.put(614, new City(614, "al-Mahallat al-Kubra", "EGY", 395402)); + cities.put(615, new City(615, "Tanta", "EGY", 371010)); + cities.put(616, new City(616, "al-Mansura", "EGY", 369621)); + cities.put(617, new City(617, "Luxor", "EGY", 360503)); + cities.put(618, new City(618, "Asyut", "EGY", 343498)); + cities.put(619, new City(619, "Bahtim", "EGY", 275807)); + cities.put(620, new City(620, "Zagazig", "EGY", 267351)); + cities.put(621, new City(621, "al-Faiyum", "EGY", 260964)); + cities.put(622, new City(622, "Ismailia", "EGY", 254477)); + cities.put(623, new City(623, "Kafr al-Dawwar", "EGY", 231978)); + cities.put(624, new City(624, "Assuan", "EGY", 219017)); + cities.put(625, new City(625, "Damanhur", "EGY", 212203)); + cities.put(626, new City(626, "al-Minya", "EGY", 201360)); + cities.put(627, new City(627, "Bani Suwayf", "EGY", 172032)); + cities.put(628, new City(628, "Qina", "EGY", 171275)); + cities.put(629, new City(629, "Sawhaj", "EGY", 170125)); + cities.put(630, new City(630, "Shibin al-Kawm", "EGY", 159909)); + cities.put(631, new City(631, "Bulaq al-Dakrur", "EGY", 148787)); + cities.put(632, new City(632, "Banha", "EGY", 145792)); + cities.put(633, new City(633, "Warraq al-Arab", "EGY", 127108)); + cities.put(634, new City(634, "Kafr al-Shaykh", "EGY", 124819)); + cities.put(635, new City(635, "Mallawi", "EGY", 119283)); + cities.put(636, new City(636, "Bilbays", "EGY", 113608)); + cities.put(637, new City(637, "Mit Ghamr", "EGY", 101801)); + cities.put(638, new City(638, "al-Arish", "EGY", 100447)); + cities.put(639, new City(639, "Talkha", "EGY", 97700)); + cities.put(640, new City(640, "Qalyub", "EGY", 97200)); + cities.put(641, new City(641, "Jirja", "EGY", 95400)); + cities.put(642, new City(642, "Idfu", "EGY", 94200)); + cities.put(643, new City(643, "al-Hawamidiya", "EGY", 91700)); + cities.put(644, new City(644, "Disuq", "EGY", 91300)); + cities.put(645, new City(645, "San Salvador", "SLV", 415346)); + cities.put(646, new City(646, "Santa Ana", "SLV", 139389)); + cities.put(647, new City(647, "Mejicanos", "SLV", 138800)); + cities.put(648, new City(648, "Soyapango", "SLV", 129800)); + cities.put(649, new City(649, "San Miguel", "SLV", 127696)); + cities.put(650, new City(650, "Nueva San Salvador", "SLV", 98400)); + cities.put(651, new City(651, "Apopa", "SLV", 88800)); + cities.put(652, new City(652, "Asmara", "ERI", 431000)); + cities.put(653, new City(653, "Madrid", "ESP", 2879052)); + cities.put(654, new City(654, "Barcelona", "ESP", 1503451)); + cities.put(655, new City(655, "Valencia", "ESP", 739412)); + cities.put(656, new City(656, "Sevilla", "ESP", 701927)); + cities.put(657, new City(657, "Zaragoza", "ESP", 603367)); + cities.put(658, new City(658, "M laga", "ESP", 530553)); + cities.put(659, new City(659, "Bilbao", "ESP", 357589)); + cities.put(660, new City(660, "Las Palmas de Gran Canaria", "ESP", + 354757)); + cities.put(661, new City(661, "Murcia", "ESP", 353504)); + cities.put(662, new City(662, "Palma de Mallorca", "ESP", 326993)); + cities.put(663, new City(663, "Valladolid", "ESP", 319998)); + cities.put(664, new City(664, "C¢rdoba", "ESP", 311708)); + cities.put(665, new City(665, "Vigo", "ESP", 283670)); + cities.put(666, new City(666, "Alicante [Alacant]", "ESP", 272432)); + cities.put(667, new City(667, "Gij¢n", "ESP", 267980)); + cities.put(668, new City(668, "LïHospitalet de Llobregat", "ESP", + 247986)); + cities.put(669, new City(669, "Granada", "ESP", 244767)); + cities.put(670, new City(670, "A Coru¤a (La Coru¤a)", "ESP", + 243402)); + cities.put(671, new City(671, "Vitoria-Gasteiz", "ESP", 217154)); + cities.put(672, new City(672, "Santa Cruz de Tenerife", "ESP", 213050)); + cities.put(673, new City(673, "Badalona", "ESP", 209635)); + cities.put(674, new City(674, "Oviedo", "ESP", 200453)); + cities.put(675, new City(675, "M¢stoles", "ESP", 195351)); + cities.put(676, new City(676, "Elche [Elx]", "ESP", 193174)); + cities.put(677, new City(677, "Sabadell", "ESP", 184859)); + cities.put(678, new City(678, "Santander", "ESP", 184165)); + cities.put(679, new City(679, "Jerez de la Frontera", "ESP", 182660)); + cities.put(680, new City(680, "Pamplona [Iru¤a]", "ESP", 180483)); + cities.put(681, new City(681, "Donostia-San Sebasti n", "ESP", + 179208)); + cities.put(682, new City(682, "Cartagena", "ESP", 177709)); + cities.put(683, new City(683, "Legan‚s", "ESP", 173163)); + cities.put(684, new City(684, "Fuenlabrada", "ESP", 171173)); + cities.put(685, new City(685, "Almer¡a", "ESP", 169027)); + cities.put(686, new City(686, "Terrassa", "ESP", 168695)); + cities.put(687, new City(687, "Alcal  de Henares", "ESP", 164463)); + cities.put(688, new City(688, "Burgos", "ESP", 162802)); + cities.put(689, new City(689, "Salamanca", "ESP", 158720)); + cities.put(690, new City(690, "Albacete", "ESP", 147527)); + cities.put(691, new City(691, "Getafe", "ESP", 145371)); + cities.put(692, new City(692, "C diz", "ESP", 142449)); + cities.put(693, new City(693, "Alcorc¢n", "ESP", 142048)); + cities.put(694, new City(694, "Huelva", "ESP", 140583)); + cities.put(695, new City(695, "Le¢n", "ESP", 139809)); + cities.put(696, new City(696, "Castell¢n de la Plana [Castell", + "ESP", 139712)); + cities.put(697, new City(697, "Badajoz", "ESP", 136613)); + cities.put(698, new City(698, "[San Crist¢bal de] la Laguna", "ESP", + 127945)); + cities.put(699, new City(699, "Logro¤o", "ESP", 127093)); + cities.put(700, + new City(700, "Santa Coloma de Gramenet", "ESP", 120802)); + cities.put(701, new City(701, "Tarragona", "ESP", 113016)); + cities.put(702, new City(702, "Lleida (L‚rida)", "ESP", 112207)); + cities.put(703, new City(703, "Ja‚n", "ESP", 109247)); + cities.put(704, new City(704, "Ourense (Orense)", "ESP", 109120)); + cities.put(705, new City(705, "Matar¢", "ESP", 104095)); + cities.put(706, new City(706, "Algeciras", "ESP", 103106)); + cities.put(707, new City(707, "Marbella", "ESP", 101144)); + cities.put(708, new City(708, "Barakaldo", "ESP", 98212)); + cities.put(709, new City(709, "Dos Hermanas", "ESP", 94591)); + cities.put(710, new City(710, "Santiago de Compostela", "ESP", 93745)); + cities.put(711, new City(711, "Torrej¢n de Ardoz", "ESP", 92262)); + cities.put(712, new City(712, "Cape Town", "ZAF", 2352121)); + cities.put(713, new City(713, "Soweto", "ZAF", 904165)); + cities.put(714, new City(714, "Johannesburg", "ZAF", 756653)); + cities.put(715, new City(715, "Port Elizabeth", "ZAF", 752319)); + cities.put(716, new City(716, "Pretoria", "ZAF", 658630)); + cities.put(717, new City(717, "Inanda", "ZAF", 634065)); + cities.put(718, new City(718, "Durban", "ZAF", 566120)); + cities.put(719, new City(719, "Vanderbijlpark", "ZAF", 468931)); + cities.put(720, new City(720, "Kempton Park", "ZAF", 442633)); + cities.put(721, new City(721, "Alberton", "ZAF", 410102)); + cities.put(722, new City(722, "Pinetown", "ZAF", 378810)); + cities.put(723, new City(723, "Pietermaritzburg", "ZAF", 370190)); + cities.put(724, new City(724, "Benoni", "ZAF", 365467)); + cities.put(725, new City(725, "Randburg", "ZAF", 341288)); + cities.put(726, new City(726, "Umlazi", "ZAF", 339233)); + cities.put(727, new City(727, "Bloemfontein", "ZAF", 334341)); + cities.put(728, new City(728, "Vereeniging", "ZAF", 328535)); + cities.put(729, new City(729, "Wonderboom", "ZAF", 283289)); + cities.put(730, new City(730, "Roodepoort", "ZAF", 279340)); + cities.put(731, new City(731, "Boksburg", "ZAF", 262648)); + cities.put(732, new City(732, "Klerksdorp", "ZAF", 261911)); + cities.put(733, new City(733, "Soshanguve", "ZAF", 242727)); + cities.put(734, new City(734, "Newcastle", "ZAF", 222993)); + cities.put(735, new City(735, "East London", "ZAF", 221047)); + cities.put(736, new City(736, "Welkom", "ZAF", 203296)); + cities.put(737, new City(737, "Kimberley", "ZAF", 197254)); + cities.put(738, new City(738, "Uitenhage", "ZAF", 192120)); + cities.put(739, new City(739, "Chatsworth", "ZAF", 189885)); + cities.put(740, new City(740, "Mdantsane", "ZAF", 182639)); + cities.put(741, new City(741, "Krugersdorp", "ZAF", 181503)); + cities.put(742, new City(742, "Botshabelo", "ZAF", 177971)); + cities.put(743, new City(743, "Brakpan", "ZAF", 171363)); + cities.put(744, new City(744, "Witbank", "ZAF", 167183)); + cities.put(745, new City(745, "Oberholzer", "ZAF", 164367)); + cities.put(746, new City(746, "Germiston", "ZAF", 164252)); + cities.put(747, new City(747, "Springs", "ZAF", 162072)); + cities.put(748, new City(748, "Westonaria", "ZAF", 159632)); + cities.put(749, new City(749, "Randfontein", "ZAF", 120838)); + cities.put(750, new City(750, "Paarl", "ZAF", 105768)); + cities.put(751, new City(751, "Potchefstroom", "ZAF", 101817)); + cities.put(752, new City(752, "Rustenburg", "ZAF", 97008)); + cities.put(753, new City(753, "Nigel", "ZAF", 96734)); + cities.put(754, new City(754, "George", "ZAF", 93818)); + cities.put(755, new City(755, "Ladysmith", "ZAF", 89292)); + cities.put(756, new City(756, "Addis Abeba", "ETH", 2495000)); + cities.put(757, new City(757, "Dire Dawa", "ETH", 164851)); + cities.put(758, new City(758, "Nazret", "ETH", 127842)); + cities.put(759, new City(759, "Gonder", "ETH", 112249)); + cities.put(760, new City(760, "Dese", "ETH", 97314)); + cities.put(761, new City(761, "Mekele", "ETH", 96938)); + cities.put(762, new City(762, "Bahir Dar", "ETH", 96140)); + cities.put(763, new City(763, "Stanley", "FLK", 1636)); + cities.put(764, new City(764, "Suva", "FJI", 77366)); + cities.put(765, new City(765, "Quezon", "PHL", 2173831)); + cities.put(766, new City(766, "Manila", "PHL", 1581082)); + cities.put(767, new City(767, "Kalookan", "PHL", 1177604)); + cities.put(768, new City(768, "Davao", "PHL", 1147116)); + cities.put(769, new City(769, "Cebu", "PHL", 718821)); + cities.put(770, new City(770, "Zamboanga", "PHL", 601794)); + cities.put(771, new City(771, "Pasig", "PHL", 505058)); + cities.put(772, new City(772, "Valenzuela", "PHL", 485433)); + cities.put(773, new City(773, "Las Pi¤as", "PHL", 472780)); + cities.put(774, new City(774, "Antipolo", "PHL", 470866)); + cities.put(775, new City(775, "Taguig", "PHL", 467375)); + cities.put(776, new City(776, "Cagayan de Oro", "PHL", 461877)); + cities.put(777, new City(777, "Para¤aque", "PHL", 449811)); + cities.put(778, new City(778, "Makati", "PHL", 444867)); + cities.put(779, new City(779, "Bacolod", "PHL", 429076)); + cities.put(780, new City(780, "General Santos", "PHL", 411822)); + cities.put(781, new City(781, "Marikina", "PHL", 391170)); + cities.put(782, new City(782, "Dasmari¤as", "PHL", 379520)); + cities.put(783, new City(783, "Muntinlupa", "PHL", 379310)); + cities.put(784, new City(784, "Iloilo", "PHL", 365820)); + cities.put(785, new City(785, "Pasay", "PHL", 354908)); + cities.put(786, new City(786, "Malabon", "PHL", 338855)); + cities.put(787, + new City(787, "San Jos‚ del Monte", "PHL", 315807)); + cities.put(788, new City(788, "Bacoor", "PHL", 305699)); + cities.put(789, new City(789, "Iligan", "PHL", 285061)); + cities.put(790, new City(790, "Calamba", "PHL", 281146)); + cities.put(791, new City(791, "Mandaluyong", "PHL", 278474)); + cities.put(792, new City(792, "Butuan", "PHL", 267279)); + cities.put(793, new City(793, "Angeles", "PHL", 263971)); + cities.put(794, new City(794, "Tarlac", "PHL", 262481)); + cities.put(795, new City(795, "Mandaue", "PHL", 259728)); + cities.put(796, new City(796, "Baguio", "PHL", 252386)); + cities.put(797, new City(797, "Batangas", "PHL", 247588)); + cities.put(798, new City(798, "Cainta", "PHL", 242511)); + cities.put(799, new City(799, "San Pedro", "PHL", 231403)); + cities.put(800, new City(800, "Navotas", "PHL", 230403)); + cities.put(801, new City(801, "Cabanatuan", "PHL", 222859)); + cities.put(802, new City(802, "San Fernando", "PHL", 221857)); + cities.put(803, new City(803, "Lipa", "PHL", 218447)); + cities.put(804, new City(804, "Lapu-Lapu", "PHL", 217019)); + cities.put(805, new City(805, "San Pablo", "PHL", 207927)); + cities.put(806, new City(806, "Bi¤an", "PHL", 201186)); + cities.put(807, new City(807, "Taytay", "PHL", 198183)); + cities.put(808, new City(808, "Lucena", "PHL", 196075)); + cities.put(809, new City(809, "Imus", "PHL", 195482)); + cities.put(810, new City(810, "Olongapo", "PHL", 194260)); + cities.put(811, new City(811, "Binangonan", "PHL", 187691)); + cities.put(812, new City(812, "Santa Rosa", "PHL", 185633)); + cities.put(813, new City(813, "Tagum", "PHL", 179531)); + cities.put(814, new City(814, "Tacloban", "PHL", 178639)); + cities.put(815, new City(815, "Malolos", "PHL", 175291)); + cities.put(816, new City(816, "Mabalacat", "PHL", 171045)); + cities.put(817, new City(817, "Cotabato", "PHL", 163849)); + cities.put(818, new City(818, "Meycauayan", "PHL", 163037)); + cities.put(819, new City(819, "Puerto Princesa", "PHL", 161912)); + cities.put(820, new City(820, "Legazpi", "PHL", 157010)); + cities.put(821, new City(821, "Silang", "PHL", 156137)); + cities.put(822, new City(822, "Ormoc", "PHL", 154297)); + cities.put(823, new City(823, "San Carlos", "PHL", 154264)); + cities.put(824, new City(824, "Kabankalan", "PHL", 149769)); + cities.put(825, new City(825, "Talisay", "PHL", 148110)); + cities.put(826, new City(826, "Valencia", "PHL", 147924)); + cities.put(827, new City(827, "Calbayog", "PHL", 147187)); + cities.put(828, new City(828, "Santa Maria", "PHL", 144282)); + cities.put(829, new City(829, "Pagadian", "PHL", 142515)); + cities.put(830, new City(830, "Cadiz", "PHL", 141954)); + cities.put(831, new City(831, "Bago", "PHL", 141721)); + cities.put(832, new City(832, "Toledo", "PHL", 141174)); + cities.put(833, new City(833, "Naga", "PHL", 137810)); + cities.put(834, new City(834, "San Mateo", "PHL", 135603)); + cities.put(835, new City(835, "Panabo", "PHL", 133950)); + cities.put(836, new City(836, "Koronadal", "PHL", 133786)); + cities.put(837, new City(837, "Marawi", "PHL", 131090)); + cities.put(838, new City(838, "Dagupan", "PHL", 130328)); + cities.put(839, new City(839, "Sagay", "PHL", 129765)); + cities.put(840, new City(840, "Roxas", "PHL", 126352)); + cities.put(841, new City(841, "Lubao", "PHL", 125699)); + cities.put(842, new City(842, "Digos", "PHL", 125171)); + cities.put(843, new City(843, "San Miguel", "PHL", 123824)); + cities.put(844, new City(844, "Malaybalay", "PHL", 123672)); + cities.put(845, new City(845, "Tuguegarao", "PHL", 120645)); + cities.put(846, new City(846, "Ilagan", "PHL", 119990)); + cities.put(847, new City(847, "Baliuag", "PHL", 119675)); + cities.put(848, new City(848, "Surigao", "PHL", 118534)); + cities.put(849, new City(849, "San Carlos", "PHL", 118259)); + cities.put(850, new City(850, "San Juan del Monte", "PHL", 117680)); + cities.put(851, new City(851, "Tanauan", "PHL", 117539)); + cities.put(852, new City(852, "Concepcion", "PHL", 115171)); + cities.put(853, new City(853, "Rodriguez (Montalban)", "PHL", 115167)); + cities.put(854, new City(854, "Sariaya", "PHL", 114568)); + cities.put(855, new City(855, "Malasiqui", "PHL", 113190)); + cities.put(856, new City(856, "General Mariano Alvarez", "PHL", 112446)); + cities.put(857, new City(857, "Urdaneta", "PHL", 111582)); + cities.put(858, new City(858, "Hagonoy", "PHL", 111425)); + cities.put(859, new City(859, "San Jose", "PHL", 111009)); + cities.put(860, new City(860, "Polomolok", "PHL", 110709)); + cities.put(861, new City(861, "Santiago", "PHL", 110531)); + cities.put(862, new City(862, "Tanza", "PHL", 110517)); + cities.put(863, new City(863, "Ozamis", "PHL", 110420)); + cities.put(864, new City(864, "Mexico", "PHL", 109481)); + cities.put(865, new City(865, "San Jose", "PHL", 108254)); + cities.put(866, new City(866, "Silay", "PHL", 107722)); + cities.put(867, new City(867, "General Trias", "PHL", 107691)); + cities.put(868, new City(868, "Tabaco", "PHL", 107166)); + cities.put(869, new City(869, "Cabuyao", "PHL", 106630)); + cities.put(870, new City(870, "Calapan", "PHL", 105910)); + cities.put(871, new City(871, "Mati", "PHL", 105908)); + cities.put(872, new City(872, "Midsayap", "PHL", 105760)); + cities.put(873, new City(873, "Cauayan", "PHL", 103952)); + cities.put(874, new City(874, "Gingoog", "PHL", 102379)); + cities.put(875, new City(875, "Dumaguete", "PHL", 102265)); + cities.put(876, new City(876, "San Fernando", "PHL", 102082)); + cities.put(877, new City(877, "Arayat", "PHL", 101792)); + cities.put(878, new City(878, "Bayawan (Tulong)", "PHL", 101391)); + cities.put(879, new City(879, "Kidapawan", "PHL", 101205)); + cities.put(880, new City(880, "Daraga (Locsin)", "PHL", 101031)); + cities.put(881, new City(881, "Marilao", "PHL", 101017)); + cities.put(882, new City(882, "Malita", "PHL", 100000)); + cities.put(883, new City(883, "Dipolog", "PHL", 99862)); + cities.put(884, new City(884, "Cavite", "PHL", 99367)); + cities.put(885, new City(885, "Danao", "PHL", 98781)); + cities.put(886, new City(886, "Bislig", "PHL", 97860)); + cities.put(887, new City(887, "Talavera", "PHL", 97329)); + cities.put(888, new City(888, "Guagua", "PHL", 96858)); + cities.put(889, new City(889, "Bayambang", "PHL", 96609)); + cities.put(890, new City(890, "Nasugbu", "PHL", 96113)); + cities.put(891, new City(891, "Baybay", "PHL", 95630)); + cities.put(892, new City(892, "Capas", "PHL", 95219)); + cities.put(893, new City(893, "Sultan Kudarat", "PHL", 94861)); + cities.put(894, new City(894, "Laoag", "PHL", 94466)); + cities.put(895, new City(895, "Bayugan", "PHL", 93623)); + cities.put(896, new City(896, "Malungon", "PHL", 93232)); + cities.put(897, new City(897, "Santa Cruz", "PHL", 92694)); + cities.put(898, new City(898, "Sorsogon", "PHL", 92512)); + cities.put(899, new City(899, "Candelaria", "PHL", 92429)); + cities.put(900, new City(900, "Ligao", "PHL", 90603)); + cities.put(901, new City(901, "T¢rshavn", "FRO", 14542)); + cities.put(902, new City(902, "Libreville", "GAB", 419000)); + cities.put(903, new City(903, "Serekunda", "GMB", 102600)); + cities.put(904, new City(904, "Banjul", "GMB", 42326)); + cities.put(905, new City(905, "Tbilisi", "GEO", 1235200)); + cities.put(906, new City(906, "Kutaisi", "GEO", 240900)); + cities.put(907, new City(907, "Rustavi", "GEO", 155400)); + cities.put(908, new City(908, "Batumi", "GEO", 137700)); + cities.put(909, new City(909, "Sohumi", "GEO", 111700)); + cities.put(910, new City(910, "Accra", "GHA", 1070000)); + cities.put(911, new City(911, "Kumasi", "GHA", 385192)); + cities.put(912, new City(912, "Tamale", "GHA", 151069)); + cities.put(913, new City(913, "Tema", "GHA", 109975)); + cities.put(914, new City(914, "Sekondi-Takoradi", "GHA", 103653)); + cities.put(915, new City(915, "Gibraltar", "GIB", 27025)); + cities.put(916, new City(916, "Saint Georgeïs", "GRD", 4621)); + cities.put(917, new City(917, "Nuuk", "GRL", 13445)); + cities.put(918, new City(918, "Les Abymes", "GLP", 62947)); + cities.put(919, new City(919, "Basse-Terre", "GLP", 12433)); + cities.put(920, new City(920, "Tamuning", "GUM", 9500)); + cities.put(921, new City(921, "Aga¤a", "GUM", 1139)); + cities.put(922, new City(922, "Ciudad de Guatemala", "GTM", 823301)); + cities.put(923, new City(923, "Mixco", "GTM", 209791)); + cities.put(924, new City(924, "Villa Nueva", "GTM", 101295)); + cities.put(925, new City(925, "Quetzaltenango", "GTM", 90801)); + cities.put(926, new City(926, "Conakry", "GIN", 1090610)); + cities.put(927, new City(927, "Bissau", "GNB", 241000)); + cities.put(928, new City(928, "Georgetown", "GUY", 254000)); + cities.put(929, new City(929, "Port-au-Prince", "HTI", 884472)); + cities.put(930, new City(930, "Carrefour", "HTI", 290204)); + cities.put(931, new City(931, "Delmas", "HTI", 240429)); + cities.put(932, new City(932, "Le-Cap-Ha‹tien", "HTI", 102233)); + cities.put(933, new City(933, "Tegucigalpa", "HND", 813900)); + cities.put(934, new City(934, "San Pedro Sula", "HND", 383900)); + cities.put(935, new City(935, "La Ceiba", "HND", 89200)); + cities.put(936, + new City(936, "Kowloon and New Kowloon", "HKG", 1987996)); + cities.put(937, new City(937, "Victoria", "HKG", 1312637)); + cities.put(938, new City(938, "Longyearbyen", "SJM", 1438)); + cities.put(939, new City(939, "Jakarta", "IDN", 9604900)); + cities.put(940, new City(940, "Surabaya", "IDN", 2663820)); + cities.put(941, new City(941, "Bandung", "IDN", 2429000)); + cities.put(942, new City(942, "Medan", "IDN", 1843919)); + cities.put(943, new City(943, "Palembang", "IDN", 1222764)); + cities.put(944, new City(944, "Tangerang", "IDN", 1198300)); + cities.put(945, new City(945, "Semarang", "IDN", 1104405)); + cities.put(946, new City(946, "Ujung Pandang", "IDN", 1060257)); + cities.put(947, new City(947, "Malang", "IDN", 716862)); + cities.put(948, new City(948, "Bandar Lampung", "IDN", 680332)); + cities.put(949, new City(949, "Bekasi", "IDN", 644300)); + cities.put(950, new City(950, "Padang", "IDN", 534474)); + cities.put(951, new City(951, "Surakarta", "IDN", 518600)); + cities.put(952, new City(952, "Banjarmasin", "IDN", 482931)); + cities.put(953, new City(953, "Pekan Baru", "IDN", 438638)); + cities.put(954, new City(954, "Denpasar", "IDN", 435000)); + cities.put(955, new City(955, "Yogyakarta", "IDN", 418944)); + cities.put(956, new City(956, "Pontianak", "IDN", 409632)); + cities.put(957, new City(957, "Samarinda", "IDN", 399175)); + cities.put(958, new City(958, "Jambi", "IDN", 385201)); + cities.put(959, new City(959, "Depok", "IDN", 365200)); + cities.put(960, new City(960, "Cimahi", "IDN", 344600)); + cities.put(961, new City(961, "Balikpapan", "IDN", 338752)); + cities.put(962, new City(962, "Manado", "IDN", 332288)); + cities.put(963, new City(963, "Mataram", "IDN", 306600)); + cities.put(964, new City(964, "Pekalongan", "IDN", 301504)); + cities.put(965, new City(965, "Tegal", "IDN", 289744)); + cities.put(966, new City(966, "Bogor", "IDN", 285114)); + cities.put(967, new City(967, "Ciputat", "IDN", 270800)); + cities.put(968, new City(968, "Pondokgede", "IDN", 263200)); + cities.put(969, new City(969, "Cirebon", "IDN", 254406)); + cities.put(970, new City(970, "Kediri", "IDN", 253760)); + cities.put(971, new City(971, "Ambon", "IDN", 249312)); + cities.put(972, new City(972, "Jember", "IDN", 218500)); + cities.put(973, new City(973, "Cilacap", "IDN", 206900)); + cities.put(974, new City(974, "Cimanggis", "IDN", 205100)); + cities.put(975, new City(975, "Pematang Siantar", "IDN", 203056)); + cities.put(976, new City(976, "Purwokerto", "IDN", 202500)); + cities.put(977, new City(977, "Ciomas", "IDN", 187400)); + cities.put(978, new City(978, "Tasikmalaya", "IDN", 179800)); + cities.put(979, new City(979, "Madiun", "IDN", 171532)); + cities.put(980, new City(980, "Bengkulu", "IDN", 146439)); + cities.put(981, new City(981, "Karawang", "IDN", 145000)); + cities.put(982, new City(982, "Banda Aceh", "IDN", 143409)); + cities.put(983, new City(983, "Palu", "IDN", 142800)); + cities.put(984, new City(984, "Pasuruan", "IDN", 134019)); + cities.put(985, new City(985, "Kupang", "IDN", 129300)); + cities.put(986, new City(986, "Tebing Tinggi", "IDN", 129300)); + cities.put(987, new City(987, "Percut Sei Tuan", "IDN", 129000)); + cities.put(988, new City(988, "Binjai", "IDN", 127222)); + cities.put(989, new City(989, "Sukabumi", "IDN", 125766)); + cities.put(990, new City(990, "Waru", "IDN", 124300)); + cities.put(991, new City(991, "Pangkal Pinang", "IDN", 124000)); + cities.put(992, new City(992, "Magelang", "IDN", 123800)); + cities.put(993, new City(993, "Blitar", "IDN", 122600)); + cities.put(994, new City(994, "Serang", "IDN", 122400)); + cities.put(995, new City(995, "Probolinggo", "IDN", 120770)); + cities.put(996, new City(996, "Cilegon", "IDN", 117000)); + cities.put(997, new City(997, "Cianjur", "IDN", 114300)); + cities.put(998, new City(998, "Ciparay", "IDN", 111500)); + cities.put(999, new City(999, "Lhokseumawe", "IDN", 109600)); + } + +} diff --git a/Programmierung2/src/streams/übungen/Country.java b/Programmierung2/src/streams/übungen/Country.java new file mode 100644 index 0000000..996484c --- /dev/null +++ b/Programmierung2/src/streams/übungen/Country.java @@ -0,0 +1,92 @@ +package streams.übungen; + +import java.util.*; + +public class Country { + private String code; // z. B. Länder-Code + private String name; // Name des Landes + private String kontinent; // Kontinent + private double flaeche; // Fläche + private int bevoelkerung; // Bevölkerung + private double bruttosozialprodukt; // BSP + private int hauptstadt; // Hauptstadt (ID oder Referenz) + private ArrayList Cities; // Liste der Städte + + + public Country(String code, String name, String kontinent, int bevoelkerung, + double flaeche, double bruttosozialprodukt, int hauptstadt) { + this.Cities = new ArrayList<>(); + this.code = code; + this.name = name; + this.kontinent = kontinent; + this.flaeche = flaeche; + this.bevoelkerung = bevoelkerung; + this.hauptstadt = hauptstadt; + this.bruttosozialprodukt = bruttosozialprodukt; + } + + public String getCode() { + return code; + } + + public void setCode(String code) { + this.code = code; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getKontinent() { + return kontinent; + } + + public void setKontinent(String kontinent) { + this.kontinent = kontinent; + } + + public double getFlaeche() { + return flaeche; + } + + public void setFlaeche(double flaeche) { + this.flaeche = flaeche; + } + + public double getBruttosozialprodukt() { + return bruttosozialprodukt; + } + + public void setBruttosozialprodukt(double bruttosozialprodukt) { + this.bruttosozialprodukt = bruttosozialprodukt; + } + + public int getHauptstadt() { + return hauptstadt; + } + + public void setHauptstadt(int hauptstadt) { + this.hauptstadt = hauptstadt; + } + + public void setBevoelkerung(int bevoelkerung) { + this.bevoelkerung = bevoelkerung; + } + + public int getBevoelkerung() { + return bevoelkerung; + } + + public ArrayList getCities() { + return Cities; + } + + @Override + public String toString() { + return "Land [ name=" + name + ", bevoelkerung=" + bevoelkerung + "]"; + } +} diff --git a/Programmierung2/src/streams/übungen/CountryTest.java b/Programmierung2/src/streams/übungen/CountryTest.java new file mode 100644 index 0000000..dc885c2 --- /dev/null +++ b/Programmierung2/src/streams/übungen/CountryTest.java @@ -0,0 +1,51 @@ +package streams.übungen; + +import java.util.ArrayList; + +public class CountryTest { + ArrayList test; + + CountryTest(){ + test = new ArrayList<>(); + coutryTest(); + } + + public void coutryTest() { + // Erstelle Cities + City berlin = new City(1, "Berlin", "DE", 3769000); + City hamburg = new City(2, "Hamburg", "DE", 1845000); + City munich = new City(3, "Munich", "DE", 1472000); + City baden = new City(2, "Baden", "DE", 1845000222); + + City paris = new City(4, "Paris", "FR", 2148000); + City lyon = new City(5, "Lyon", "FR", 515695); + City marseille = new City(6, "Marseille", "FR", 861635); + + City tokyo = new City(7, "Tokyo", "JP", 13929000); + City osaka = new City(8, "Osaka", "JP", 2725000); + City kyoto = new City(9, "Kyoto", "JP", 1474570); + + // Erstelle Countries + Country germany = new Country("DE", "Germany", "Europe", 83020000, 357022.0, 4.2, 1); + germany.getCities().add(berlin); + germany.getCities().add(hamburg); + germany.getCities().add(munich); + germany.getCities().add(baden); + + Country france = new Country("FR", "France", "Europe", 67060000, 551695.0, 2.8, 4); + france.getCities().add(paris); + france.getCities().add(lyon); + france.getCities().add(marseille); + + Country japan = new Country("JP", "Japan", "Asia", 125800000, 377975.0, 5.2, 7); + japan.getCities().add(tokyo); + japan.getCities().add(osaka); + japan.getCities().add(kyoto); + + // Füge Countries zur Liste hinzu + test.add(germany); + test.add(france); + test.add(japan); + } + +} diff --git a/Programmierung2/src/streams/übungen/Main.java b/Programmierung2/src/streams/übungen/Main.java new file mode 100644 index 0000000..4d6cf8d --- /dev/null +++ b/Programmierung2/src/streams/übungen/Main.java @@ -0,0 +1,138 @@ +package streams.übungen; + +import java.util.*; +import java.util.stream.Collectors; +import java.util.stream.IntStream; + +public class Main { + + public static void main(String[] args) { + + countryTest(); + + + } + + public static void countryTest() { + CountryTest test = new CountryTest(); + //Q.2) Find the most populated city of each country + Map q2 = test.test + .stream() + .parallel() + .collect(Collectors.toMap( + country -> country, + country -> country.getCities().stream() + .max(Comparator.comparingInt(t -> t.getPopulation())) + .orElse(null) + )); + + // q2.forEach((a,b) -> System.out.println(a + " " + b)); + + + //finde die Länder mit ihrer Städte. + Map> q6 = test.test + .stream() + .collect(Collectors.toMap( + country -> country, + country -> country.getCities().stream() + .collect(Collectors.toCollection(ArrayList::new)) + )); + + //q6.forEach((a,b) -> System.out.println(a + " " + b.toString())); + + + // Durchschnitt jedes Land + Map q5 = test.test.stream() + .collect(Collectors.toMap( + country -> country, + country -> country.getCities().stream() + .collect(Collectors.averagingDouble(e -> e.getPopulation())))); + + //q5.forEach((a,b) -> System.out.println(a + " " + b)); +// +// test.test.stream() +// .forEach(t -> { +// System.out.println(t.getName()); +// t.getCities().stream() +// .forEach(f -> System.out.println("Stadt: " + f.getName())); +// }); + + + // Paralleler Stream mit forEach (Reihenfolge nicht garantiert) + System.out.println("Paralleler Stream mit forEach:"); + ArrayList s1 = new ArrayList<>(); + s1.add(1); + s1.add(5); + s1.add(4); + s1.add(2); + s1.parallelStream().sorted().forEach(System.out::println); + ArrayList s4 = s1.stream().parallel().sorted().collect(Collectors.toCollection(ArrayList::new)); + System.out.println(s4); + + System.out.println("\nParalleler Stream mit forEachOrdered:"); + // Paralleler Stream mit forEachOrdered (Reihenfolge garantiert) + ArrayList s2 = new ArrayList<>(); + s2.add(1); + s2.add(5); + s2.add(4); + s2.add(2); + s2.parallelStream().sorted().forEachOrdered(System.out::print); + } + + public static void cityTest() { + CityTest test = new CityTest(); + //Map> + City x = test.cities.values() + .stream() + .max(Comparator.comparingInt(c -> c.getPopulation())) + .orElse(null); + + System.out.println(x.toString()); + + Map> nachCod = test.cities.values() + .stream() + .collect(Collectors.groupingBy(t -> t.getCountryCode(), Collectors.toCollection(ArrayList::new))); + + nachCod.forEach((a,b) -> System.out.println("countryCode: " + a + " " + b)); + + } + + public static void movieTest() { + MovieTest test = new MovieTest(); +// +// Map moviesPerDirector = test.movies.values().stream() +// .flatMap(movie -> movie.getDirectors().stream()) +// .collect(Collectors.groupingBy(director -> director, Collectors.counting())); // Gruppieren und zählen +// +// +// moviesPerDirector.forEach((director, count) -> { +// System.out.println("Director: " + director.getName() + ", Movies: " + count); +// }); +// +// +// Map anzahlGenresjedesFilm = test.movies.values().stream() +// .flatMap(movie -> movie.getGenres().stream()) +// .collect(Collectors.groupingBy(g -> g , Collectors.counting())); +// +// anzahlGenresjedesFilm.forEach((genre, count) -> { +// System.out.println("Genre: " + genre.getName() + ", Movies: " + count); +// }); + + Map> movies = test.movies + .stream() + .collect(Collectors.partitioningBy(m -> m.getGenre().equalsIgnoreCase("Drama") || m.getGenre().equalsIgnoreCase("Komödie"), Collectors.toCollection(ArrayList::new))); + +// List ohne = movies.get(false); +// ohne.forEach(System.out::println); + +// List mit = movies.get(true); +// mit.forEach(System.out::println); + + Map> nachJahr = test.movies + .stream() + .collect(Collectors.groupingBy(m -> m.getYear(), Collectors.toCollection(ArrayList::new))); + + nachJahr.forEach((a,b) -> System.out.println(a +" "+ b + "\n")); + } + +} diff --git a/Programmierung2/src/streams/übungen/Movie.java b/Programmierung2/src/streams/übungen/Movie.java new file mode 100644 index 0000000..2f4ffe4 --- /dev/null +++ b/Programmierung2/src/streams/übungen/Movie.java @@ -0,0 +1,44 @@ +package streams.übungen; + +public class Movie { + private int id; + private String title; + private int year; + private String genre; + private String director; + + public Movie(int id, String title, int year, String genre, String director) { + this.id = id; + this.title = title; + this.year = year; + this.genre = genre; + this.director = director; + } + + public int getId() { + return id; + } + + public String getTitle() { + return title; + } + + public int getYear() { + return year; + } + + public String getGenre() { + return genre; + } + + public String getDirector() { + return director; + } + + @Override + public String toString() { + return "Movie [id=" + id + ", title=" + title + ", year=" + year + ", genre=" + genre + ", director=" + director + + "]"; + } + +} diff --git a/Programmierung2/src/streams/übungen/MovieTest.java b/Programmierung2/src/streams/übungen/MovieTest.java new file mode 100644 index 0000000..d595a4f --- /dev/null +++ b/Programmierung2/src/streams/übungen/MovieTest.java @@ -0,0 +1,51 @@ +package streams.übungen; + +import java.util.*; + + + +public class MovieTest { + ArrayList movies; + + + + public MovieTest() { + movies = new ArrayList<>(); + populate(); + } + public void populate() { + movies.add(new Movie(1, "500 Days Of Summer", 2009, "Romance", "Marc Webb")); + movies.add(new Movie(2, "Beyond a Reasonable Doubt", 2009, "Thriller", "Peter Hyams")); + movies.add(new Movie(3, "Gamer", 2009, "Action", "Mark Neveldine")); + movies.add(new Movie(4, "Cheri", 2009, "Drama", "Stephen Frears")); + movies.add(new Movie(5, "Dorian Gray", 2009, "Fantasy", "Oliver Parker")); + movies.add(new Movie(6, "Inglourious Basterds", 2009, "War", "Quentin Tarantino")); + movies.add(new Movie(7, "Invictus", 2009, "Biography", "Clint Eastwood")); + movies.add(new Movie(8, "Julie and Julia", 2009, "Drama", "Nora Ephron")); + movies.add(new Movie(9, "Los abrazos rotos", 2009, "Drama", "Pedro Almodovar")); + movies.add(new Movie(10, "Of Mice and Men", 1992, "Drama", "Gary Sinise")); + movies.add(new Movie(11, "Armored", 2009, "Thriller", "Nimród Antal")); + movies.add(new Movie(12, "Bornova Bornova", 2009, "Drama", "Inan Temelkuran")); + movies.add(new Movie(13, "Coco avant Chanel", 2009, "Biography", "Anne Fontaine")); + movies.add(new Movie(14, "Nefes: Vatan Sagolsun", 2009, "War", "Levent Semerci")); + movies.add(new Movie(15, "Up", 2009, "Animation", "Pete Docter")); + movies.add(new Movie(16, "Whiteout", 2009, "Thriller", "Dominic Sena")); + movies.add(new Movie(17, "The Time Travelers Wife", 2009, "Romance", "Robert Schwentke")); + movies.add(new Movie(18, "Whatever Works", 2009, "Comedy", "Woody Allen")); + movies.add(new Movie(19, "Anonyma - Eine Frau in Berlin", 2009, "Drama", "Max Färberböck")); + movies.add(new Movie(20, "Zombieland", 2009, "Comedy", "Ruben Fleischer")); + movies.add(new Movie(21, "Weather Girl", 2009, "Comedy", "Blayne Weaver")); + movies.add(new Movie(22, "Watchmen", 2009, "Action", "Zack Snyder")); + movies.add(new Movie(23, "Adam Resurrected", 2008, "Drama", "Paul Schrader")); + movies.add(new Movie(24, "Angels and Demons", 2009, "Mystery", "Ron Howard")); + movies.add(new Movie(25, "Away We Go", 2009, "Romance", "Sam Mendes")); + movies.add(new Movie(26, "Last Ride", 2009, "Drama", "Glendyn Ivin")); + movies.add(new Movie(27, "The Boys Are Back", 2009, "Drama", "Scott Hicks")); + movies.add(new Movie(28, "Nothing But the Truth", 2008, "Drama", "Rod Lurie")); + movies.add(new Movie(29, "100 Feet", 2008, "Horror", "Eric Red")); + movies.add(new Movie(30, "The Tournament", 2009, "Action", "Scott Mann")); + } + + + +}