Class SharedSingletonMapTemplate<K>

    • Method Detail

      • ordered

        public static <K> @NonNull SharedSingletonMapTemplate<K> ordered​(K key)
        Create a template which produces Maps with specified key. The resulting map will retain insertion order through UnmodifiableMapPhase.toModifiableMap() transformations.
        Type Parameters:
        K - the type of keys maintained by resulting template
        Parameters:
        key - Single key in resulting map
        Returns:
        A template object.
        Throws:
        NullPointerException - if key is null
      • unordered

        public static <K> @NonNull SharedSingletonMapTemplate<K> unordered​(K key)
        Create a template which produces Maps with specified key. The resulting map will NOT retain ordering through UnmodifiableMapPhase.toModifiableMap() transformations.
        Type Parameters:
        K - the type of keys maintained by resulting template
        Parameters:
        key - Single key in resulting map
        Returns:
        A template object.
        Throws:
        NullPointerException - if key is null
      • instantiateTransformed

        public final <T,​V> @NonNull SharedSingletonMap<K,​V> instantiateTransformed​(Map<K,​T> fromMap,
                                                                                               BiFunction<K,​T,​V> valueTransformer)
        Description copied from class: ImmutableMapTemplate
        Instantiate an immutable map by applying specified transformer to values of fromMap.
        Specified by:
        instantiateTransformed in class ImmutableMapTemplate<K>
        Type Parameters:
        T - the type of input values
        V - the type of mapped values
        Parameters:
        fromMap - Input map
        valueTransformer - Transformation to apply to values
        Returns:
        An immutable map
      • instantiateWithValue

        public abstract <V> @NonNull SharedSingletonMap<K,​V> instantiateWithValue​(V value)
        Instantiate an immutable map with the value supplied.
        Type Parameters:
        V - the type of mapped values
        Parameters:
        value - Value to use
        Returns:
        An immutable map
        Throws:
        NullPointerException - if value is null