MetadataCollection extends ArrayList<MetadataElement> { public Set<MetadataElement> toSet() { return asSet(this); } 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);  }
@Test public void testToSet() { Set<MetadataElement> elements = new HashSet<>(); elements.add(new MetadataElement("test", "value")); MetadataCollection c = new MetadataCollection(elements); assertEquals(elements, c.toSet()); assertEquals(0, MetadataCollection.asSet(null).size()); }