@Test public void testGetValuesAsList() { assertNull(MultiMapUtils.getValuesAsList(null, "key1")); String values[] = { "v1", "v2", "v3" }; final MultiValuedMap<String, String> map = new ArrayListValuedHashMap<String, String>(); for (String val : values) { map.put("key1", val); } List<String> list = MultiMapUtils.getValuesAsList(map, "key1"); int i = 0; for (String val : list) { assertTrue(val.equals(values[i++])); } }
public static <K, V> List<V> getValuesAsList(final MultiValuedMap<K, V> map, final K key) { if (map != null) { Collection<V> col = map.get(key); if (col instanceof List) { return (List<V>) col; } return new ArrayList<V>(col); } return null; }
MultiMapUtils { public static <K, V> List<V> getValuesAsList(final MultiValuedMap<K, V> map, final K key) { if (map != null) { Collection<V> col = map.get(key); if (col instanceof List) { return (List<V>) col; } return new ArrayList<V>(col); } return null; } }
MultiMapUtils { public static <K, V> List<V> getValuesAsList(final MultiValuedMap<K, V> map, final K key) { if (map != null) { Collection<V> col = map.get(key); if (col instanceof List) { return (List<V>) col; } return new ArrayList<V>(col); } return null; } private  MultiMapUtils(); }
MultiMapUtils { public static <K, V> List<V> getValuesAsList(final MultiValuedMap<K, V> map, final K key) { if (map != null) { Collection<V> col = map.get(key); if (col instanceof List) { return (List<V>) col; } return new ArrayList<V>(col); } return null; } private  MultiMapUtils(); @SuppressWarnings("unchecked") static MultiValuedMap<K, V> emptyMultiValuedMap(); @SuppressWarnings("unchecked") static MultiValuedMap<K, V> emptyIfNull(final MultiValuedMap<K, V> map); static boolean isEmpty(final MultiValuedMap<?, ?> map); static Collection<V> getCollection(final MultiValuedMap<K, V> map, final K key); static List<V> getValuesAsList(final MultiValuedMap<K, V> map, final K key); static Set<V> getValuesAsSet(final MultiValuedMap<K, V> map, final K key); static Bag<V> getValuesAsBag(final MultiValuedMap<K, V> map, final K key); static ListValuedMap<K, V> newListValuedHashMap(); static SetValuedMap<K, V> newSetValuedHashMap(); static MultiValuedMap<K, V> unmodifiableMultiValuedMap(
            final MultiValuedMap<? extends K, ? extends V> map); static MultiValuedMap<K, V> transformedMultiValuedMap(final MultiValuedMap<K, V> map,
            final Transformer<? super K, ? extends K> keyTransformer,
            final Transformer<? super V, ? extends V> valueTransformer); }
MultiMapUtils { public static <K, V> List<V> getValuesAsList(final MultiValuedMap<K, V> map, final K key) { if (map != null) { Collection<V> col = map.get(key); if (col instanceof List) { return (List<V>) col; } return new ArrayList<V>(col); } return null; } private  MultiMapUtils(); @SuppressWarnings("unchecked") static MultiValuedMap<K, V> emptyMultiValuedMap(); @SuppressWarnings("unchecked") static MultiValuedMap<K, V> emptyIfNull(final MultiValuedMap<K, V> map); static boolean isEmpty(final MultiValuedMap<?, ?> map); static Collection<V> getCollection(final MultiValuedMap<K, V> map, final K key); static List<V> getValuesAsList(final MultiValuedMap<K, V> map, final K key); static Set<V> getValuesAsSet(final MultiValuedMap<K, V> map, final K key); static Bag<V> getValuesAsBag(final MultiValuedMap<K, V> map, final K key); static ListValuedMap<K, V> newListValuedHashMap(); static SetValuedMap<K, V> newSetValuedHashMap(); static MultiValuedMap<K, V> unmodifiableMultiValuedMap(
            final MultiValuedMap<? extends K, ? extends V> map); static MultiValuedMap<K, V> transformedMultiValuedMap(final MultiValuedMap<K, V> map,
            final Transformer<? super K, ? extends K> keyTransformer,
            final Transformer<? super V, ? extends V> valueTransformer); @SuppressWarnings({ "rawtypes", "unchecked" })
    static final MultiValuedMap EMPTY_MULTI_VALUED_MAP; }