/** * Transforms the given {@link List} of {@link KeyValuePair}'s to a {@link Map}. * * @param <K> * The generic type of the key * @param <V> * The generic type of the value * @param list * the list * @return the new map. */ public static <K, V> Map<K, V> toMap(final Collection<KeyValuePair<K, V>> list) { final Map<K, V> map = new HashMap<>(); for (KeyValuePair<K, V> keyValuePair : list) { map.put(keyValuePair.getKey(), keyValuePair.getValue()); } return map; }
/** * {@inheritDoc} */ @Override public Object getValueAt(final int rowIndex, final int columnIndex) { final KeyValuePair<K, V> row = getData().get(rowIndex); switch (columnIndex) { case 0 : return row.getKey(); case 1 : return row.getValue(); default : return null; } }
/** * {@inheritDoc} */ @Override public Zipcode findCityFromZipcode(KeyValuePair<Country, String> countryWithZipcode) { return getDomainService().findCityFromZipcode(countryWithZipcode.getKey(), countryWithZipcode.getValue()); }
/** * {@inheritDoc} */ @Override public Federalstate findFederalstate(final KeyValuePair<Country, String> countryWithName) { return getDomainService().findFederalstate(countryWithName.getKey(), countryWithName.getValue()); }
/** * {@inheritDoc} */ @Override public List<Federalstate> findFederalstatesFromCountry( final KeyValuePair<Country, String> countryWithName) { return getDomainService().findFederalstatesFromCountry(countryWithName.getKey(), countryWithName.getValue()); }
/** * {@inheritDoc} */ @Override public List<BundleNames> importProperties(BundleApplications bundleApplication, List<KeyValuePair<File, Locale>> foundProperties) throws IOException { final List<BundleNames> list = new ArrayList<>(); for (final KeyValuePair<File, Locale> entry : foundProperties) { final File propertiesFile = entry.getKey(); final Locale locale = entry.getValue(); final String bundlename = LocaleResolver.resolveBundlename(propertiesFile); final Properties properties = PropertiesExtensions.loadProperties(propertiesFile); final BundleNames bundleNames = updateProperties(bundleApplication, properties, bundlename, locale, false); list.add(bundleNames); bundleApplication = bundleApplicationsService.merge(bundleApplication); } return list; }