Skip to content

Method: of(Map)

1: package de.fhdw.gaming.ipspiel23.c4.collections;
2:
3: import java.util.Map;
4:
5: import de.fhdw.gaming.ipspiel23.c4.collections.impl.ReadOnlyDictionaryImpl;
6:
7: /**
8: * A factory class for creating {@link IReadOnlyDictionary} instances.
9: */
10: public final class ReadOnlyDictionary {
11:
12: /**
13: * This is a "static" class, so this ctor should never be used.
14: */
15: private ReadOnlyDictionary() { }
16:
17: /**
18: * Creates a new {@link IReadOnlyDictionary} instance from the provided map.
19: *
20: * @param <TKEY> The type of the keys.
21: * @param <TVALUE> The type of the values.
22: * @param dictionary The dictionary to wrap.
23: * @return The created {@link IReadOnlyDictionary} instance.
24: */
25: public static <TKEY, TVALUE> IReadOnlyDictionary<TKEY, TVALUE> of(final Map<TKEY, TVALUE> dictionary) {
26: return new ReadOnlyDictionaryImpl<TKEY, TVALUE>(dictionary);
27: }
28: }