HashMap<String, List<ArrayList>> baza = new HashMap<>(); It is necessary to add an object called street_num to the baza array by key and ΠΈΠ½Π΄Π΅ΠΊΡΡ[0] , and then remove the last index from the key
Now using the method with an intermediate variable.
But I would like to directly add an object to the database and remove the extra one without creating an intermediate variable.
raion = baza.get("key" + num_raion); raion.add(0, street_num); raion.remove(raion.size() -1); baza.put("key" + num_raion, raion); raion.clear(); // "key" + num_raion - ΠΊΠ»ΡΡ Π΄Π»Ρ hashmap // street_num - ΠΎΠ±ΡΠ΅ΠΊΡ ΠΊΠΎΡΠΎΡΡΠΉ Π½Π°Π΄ΠΎ Π΄ΠΎΠ±Π°Π²ΠΈΡΡ ΠΏΠΎ ΠΏΡΠΈΠ½ΡΠΈΠΏΡ ΠΊΠ»ΡΡ.ΠΈΠ½Π΄Π΅ΠΊΡ // ΠΏΠΎΡΠ»Π΅Π΄Π½Π΅Π΅ Π½Π°Π΄ΠΎ ΡΠ΄Π°Π»ΠΈΡΡ Π² ΠΊΠ»ΡΡΠ΅ ΠΏΠΎΡΠ»Π΅Π΄Π½ΠΈΠΉ ΠΈΠ½Π΄Π΅ΠΊΡ