(код и описание) # First things first, we need a method to store the relationships between an item and its repository. Items are unique so you don't care about multiple units from one item. For internal saving use the HashMap-type from Java's Collection framework. # Implement the store function which has the input parameters item and repository. # store("Glasses", "Bookshelf") should result in [{Glasses=Bookshelf}]. # The storage variable should be private. !!!(ВОТ ТУТ У МЕНЯ ПРОБЛЕМА) #Think also about illegal values, which should be handeled with a IllegalArgumentException and NullPointerException. (Expected java.lang.NullPointerException to be thrown, but nothing was thrown.) class EasyStorage{ private Map<String,String> map = new HashMap<String,String>(); private Set <String>set = new HashSet<String>(); public void store(String item, String repository){ map.put(item, repository); } public Map<String, String> getAllData(){ return map; } public String getRepository(String item){ String str = ""; try{ str = map.get(item); }catch (NullPointerException e){ e.getMessage(); } return str; } public Set<String> getItems(String repository) { Set <String>set1 = new HashSet<String>(); try{ for(Map.Entry<String, String> m : map.entrySet()) { if(m.getValue().equals(repository)) { set1.add(m.getKey()); } } }catch (NullPointerException e){ e.getMessage(); } return set1; } }