Class MapViewBuilder<K,​V>

  • Type Parameters:
    K - the type of the map entry keys
    V - the type of the entry values in the backing map that is used as the source for this view
    Direct Known Subclasses:
    ViewBuilder

    public class MapViewBuilder<K,​V>
    extends Object
    The ViewBuilder provides a means to build() a map view using a fluent pattern / style.
    Since:
    20.06
    Author:
    Aleks Seovic 2020.06.06
    • Field Detail

      • m_filter

        protected Filter<?> m_filter
        The Filter that will be used to define the entries maintained in this view.
      • m_listener

        protected MapListener<? super K,​? super V> m_listener
        The MapListener that will receive all the events from the view, including those corresponding to its initial population.
      • m_mapper

        protected ValueExtractor<? super V,​?> m_mapper
        The ValueExtractor that will be used to transform values retrieved from the underlying map before storing them locally; if specified, this view will become read-only.
      • m_fCacheValues

        protected boolean m_fCacheValues
        Flag controlling if the view will store both keys and values or only keys. true by default.
    • Method Detail

      • listener

        public MapViewBuilder<K,​V> listener​(MapListener<? super K,​? super V> listener)
        The MapListener that will receive all events, including those that result from the initial population of the view.
        Parameters:
        listener - the MapListener that will receive all the events from the view, including those corresponding to its initial population.
        Returns:
        this MapViewBuilder
      • map

        public <U> MapViewBuilder<K,​U> map​(ValueExtractor<? super V,​? extends U> mapper)
        The ValueExtractor that this view will use to transform the results from the underlying map prior to storing them locally.
        Type Parameters:
        U - the type of the extracted value
        Parameters:
        mapper - the ValueExtractor that will be used to transform values retrieved from the underlying map before storing them locally; if specified, this view will become read-only
        Returns:
        this MapViewBuilder
      • values

        public MapViewBuilder<K,​V> values()
        The resulting view with both map keys and values.

        NOTE: this is mutually exclusive with keys(), and the default.
        Returns:
        this MapViewBuilder
      • build

        public NamedMap<K,​V> build()
        Construct a view of the NamedMap provided to this builder.
        Returns:
        the view of the NamedMap provided to this builder