Interface MapFactory<K,V>

All Known Subinterfaces:
MultiMapFactory<K,V>
All Known Implementing Classes:
AggregateMapFactory, GenericMultiMapFactory, PersistentMapFactory, PersistentMultiMapFactory
Functional Interface:
This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

@FunctionalInterface public interface MapFactory<K,V>
MapFactory is a Map generator. Implementations construct specific types of Maps. It is a functional interface, so a constructor which copies a map is a MapFactory: HashMap::new.

Note also that the current limitations on parametric types in Java mean that we can't easily type this class as MapFactory<M extends Map<K,V>,K,V>, as MapFactory<HashMap<K,V>,K,V> is not a subtype of MapFactory<Map<K,V>,K,V>, even though HashMap is a subtype of Map.

Author:
Felix S. Klock II <pnkfelix@mit.edu>
  • Method Summary

    Modifier and Type
    Method
    Description
    default Map<K,V>
    Generates a new, mutable, empty Map.
    makeMap(Map<? extends K,? extends V> map)
    Generates a new Map, using the entries of map as a template for its initial mappings.
  • Method Details

    • makeMap

      default Map<K,V> makeMap()
      Generates a new, mutable, empty Map.
    • makeMap

      Map<K,V> makeMap(Map<? extends K,? extends V> map)
      Generates a new Map, using the entries of map as a template for its initial mappings.