DisplayData implements Serializable { public Map<Identifier, Item> asMap() { return entries; } private  DisplayData(Map<Identifier, Item> entries); static DisplayData none(); static DisplayData from(HasDisplayData component); static @Nullable Type inferType(@Nullable Object value); @JsonValue Collection<Item> items(); Map<Identifier, Item> asMap(); @Override int hashCode(); @Override boolean equals(@Nullable Object obj); @Override String toString(); static ItemSpec<String> item(String key, @Nullable String value); static ItemSpec<?> item(String key, @Nullable ValueProvider<?> value); static ItemSpec<Integer> item(String key, @Nullable Integer value); static ItemSpec<Long> item(String key, @Nullable Long value); static ItemSpec<Float> item(String key, @Nullable Float value); static ItemSpec<Double> item(String key, @Nullable Double value); static ItemSpec<Boolean> item(String key, @Nullable Boolean value); static ItemSpec<Instant> item(String key, @Nullable Instant value); static ItemSpec<Duration> item(String key, @Nullable Duration value); static ItemSpec<Class<T>> item(String key, @Nullable Class<T> value); static ItemSpec<T> item(String key, Type type, @Nullable T value);  }
@Test public void testAsMap() { DisplayData data = DisplayData.from( new HasDisplayData() { @Override public void populateDisplayData(DisplayData.Builder builder) { builder.add(DisplayData.item("foo", "bar")); } }); Map<DisplayData.Identifier, DisplayData.Item> map = data.asMap(); assertEquals(1, map.size()); assertThat(data, hasDisplayItem("foo", "bar")); assertEquals(map.values(), data.items()); }