@Test public void testAsMap() { Set<MetadataElement> elements = new HashSet<>(); elements.add(new MetadataElement("test", "value")); Map<String, String> p = MetadataCollection.asMap(elements); assertEquals("value", p.get("test")); assertEquals(0, MetadataCollection.asMap(null).size()); }
public static Map<String, String> asMap(Collection<MetadataElement> col) { Map<String, String> result = new HashMap<String, String>(); if (col == null) { return result; } for (MetadataElement e : col) { result.put(e.getKey(), e.getValue()); } return result; }
MetadataCollection extends ArrayList<MetadataElement> { public static Map<String, String> asMap(Collection<MetadataElement> col) { Map<String, String> result = new HashMap<String, String>(); if (col == null) { return result; } for (MetadataElement e : col) { result.put(e.getKey(), e.getValue()); } return result; } }
MetadataCollection extends ArrayList<MetadataElement> { public static Map<String, String> asMap(Collection<MetadataElement> col) { Map<String, String> result = new HashMap<String, String>(); if (col == null) { return result; } for (MetadataElement e : col) { result.put(e.getKey(), e.getValue()); } return result; } MetadataCollection();  MetadataCollection(@NotNull Set<MetadataElement> elements);  MetadataCollection(@NotNull MetadataCollection metadataCollection);  MetadataCollection(@NotNull KeyValuePairBag elements);  MetadataCollection(@NotNull Map<String, String> elements);  MetadataCollection(@NotNull MetadataElement... elements); }
MetadataCollection extends ArrayList<MetadataElement> { public static Map<String, String> asMap(Collection<MetadataElement> col) { Map<String, String> result = new HashMap<String, String>(); if (col == null) { return result; } for (MetadataElement e : col) { result.put(e.getKey(), e.getValue()); } return result; } MetadataCollection();  MetadataCollection(@NotNull Set<MetadataElement> elements);  MetadataCollection(@NotNull MetadataCollection metadataCollection);  MetadataCollection(@NotNull KeyValuePairBag elements);  MetadataCollection(@NotNull Map<String, String> elements);  MetadataCollection(@NotNull MetadataElement... elements); Set<MetadataElement> toSet(); boolean containsKey(String key); static Set<MetadataElement> asSet(Collection<MetadataElement> col); static Properties asProperties(Collection<MetadataElement> col); static Map<String, String> asMap(Collection<MetadataElement> col); }
MetadataCollection extends ArrayList<MetadataElement> { public static Map<String, String> asMap(Collection<MetadataElement> col) { Map<String, String> result = new HashMap<String, String>(); if (col == null) { return result; } for (MetadataElement e : col) { result.put(e.getKey(), e.getValue()); } return result; } MetadataCollection();  MetadataCollection(@NotNull Set<MetadataElement> elements);  MetadataCollection(@NotNull MetadataCollection metadataCollection);  MetadataCollection(@NotNull KeyValuePairBag elements);  MetadataCollection(@NotNull Map<String, String> elements);  MetadataCollection(@NotNull MetadataElement... elements); Set<MetadataElement> toSet(); boolean containsKey(String key); static Set<MetadataElement> asSet(Collection<MetadataElement> col); static Properties asProperties(Collection<MetadataElement> col); static Map<String, String> asMap(Collection<MetadataElement> col);  }