### Question:
Maps { @SuppressWarnings("unchecked") public static <K, V, T> Map<K, V> toMap(List<T> entryList) throws IllegalArgumentException { Preconditions.checkNotNull(entryList, "Entry list cannot be null."); Map<K, V> result = com.google.common.collect.Maps.newHashMap(); for (Object entry : entryList) { try { Object key = PropertyUtils.getProperty(entry, "key"); Object value = PropertyUtils.getProperty(entry, "value"); result.put((K) key, (V) value); } catch (InvocationTargetException e) { throw new IllegalStateException("Unexpected exception while creating map: " + e.getMessage(), e.getTargetException()); } catch (IllegalAccessException e) { throw new IllegalStateException("Unexpected exception while creating map: " + e.getMessage(), e); } catch (NoSuchMethodException e) { throw new IllegalStateException("Unexpected exception while creating map: " + e.getMessage(), e); } } return result; } private  Maps(); @SuppressWarnings("unchecked") static Map<K, V> toMap(List<T> entryList); static Map<K, V> toMap(T[] entryArray); static T[] toArray(Map<K, V> map, T[] entryArray); static List<T> toList(Map<K, V> map, Class<T> entryClass);  }### Answer:
@Test public void testToMap_list() { Map<String, String> map = Maps.<String, String, Entry>toMap(entriesList); assertEquals(entriesMap, map); }