Class Maps


  • public class Maps
    extends java.lang.Object
    Maps is the preferred method of constructing instances of Map.

    HashMap is currently constructed in all cases, however this may change in the future.

    Maps is preferred for construction as:

    • It works better in languages that support type inference
    • It allows future optimisations (e.g. small maps may be dedicated classes which are then upgraded to HashMaps)
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      private Maps()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static <K,​V>
      @NotNull Builder<Pair<K,​V>,​Map<K,​V>>
      builder()  
      private static <K,​V>
      Map<K,​V>
      construct​(Pair<K,​V>... pairs)  
      static <K,​V>
      @NotNull Map<K,​V>
      copyOf​(Pair<K,​V>[] pairs)  
      static <K,​V>
      @NotNull Map<K,​V>
      copyOf​(java.lang.Iterable<Pair<K,​V>> iterable)  
      static <K,​V>
      @NotNull Map<K,​V>
      copyOf​(java.util.Iterator<Pair<K,​V>> iterator)  
      static <K,​V>
      @NotNull Map<K,​V>
      copyOfTraversable​(Traversable<Pair<K,​V>> traversable)  
      static <K,​V>
      @NotNull BuilderFactory<Pair<K,​V>,​Map<K,​V>>
      factory()  
      static <K,​V>
      @NotNull Map<K,​V>
      of()  
      static <K,​V>
      @NotNull Map<K,​V>
      of​(K k, V v)  
      static <K,​V>
      @NotNull Map<K,​V>
      of​(K k1, V v1, K k2, V v2)  
      static <K,​V>
      @NotNull Map<K,​V>
      of​(K k1, V v1, K k2, V v2, K k3, V v3)  
      static <K,​V>
      @NotNull Map<K,​V>
      of​(K k1, V v1, K k2, V v2, K k3, V v3, K k4, V v4)  
      static <K,​V>
      @NotNull Map<K,​V>
      of​(K k1, V v1, K k2, V v2, K k3, V v3, K k4, V v4, K k5, V v5)  
      private static <K,​V>
      Pair<K,​V>
      p​(K k, V v)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • Maps

        private Maps()
    • Method Detail

      • of

        @NotNull
        public static <K,​V> @NotNull Map<K,​V> of()
      • of

        @NotNull
        public static <K,​V> @NotNull Map<K,​V> of​(K k,
                                                             V v)
      • of

        @NotNull
        public static <K,​V> @NotNull Map<K,​V> of​(K k1,
                                                             V v1,
                                                             K k2,
                                                             V v2)
      • of

        @NotNull
        public static <K,​V> @NotNull Map<K,​V> of​(K k1,
                                                             V v1,
                                                             K k2,
                                                             V v2,
                                                             K k3,
                                                             V v3)
      • of

        @NotNull
        public static <K,​V> @NotNull Map<K,​V> of​(K k1,
                                                             V v1,
                                                             K k2,
                                                             V v2,
                                                             K k3,
                                                             V v3,
                                                             K k4,
                                                             V v4)
      • of

        @NotNull
        public static <K,​V> @NotNull Map<K,​V> of​(K k1,
                                                             V v1,
                                                             K k2,
                                                             V v2,
                                                             K k3,
                                                             V v3,
                                                             K k4,
                                                             V v4,
                                                             K k5,
                                                             V v5)
      • p

        private static <K,​V> Pair<K,​V> p​(K k,
                                                     V v)
      • construct

        private static <K,​V> Map<K,​V> construct​(Pair<K,​V>... pairs)
      • copyOf

        @NotNull
        public static <K,​V> @NotNull Map<K,​V> copyOf​(java.lang.Iterable<Pair<K,​V>> iterable)
      • copyOf

        @NotNull
        public static <K,​V> @NotNull Map<K,​V> copyOf​(java.util.Iterator<Pair<K,​V>> iterator)
      • copyOf

        @NotNull
        public static <K,​V> @NotNull Map<K,​V> copyOf​(Pair<K,​V>[] pairs)
      • copyOfTraversable

        @NotNull
        public static <K,​V> @NotNull Map<K,​V> copyOfTraversable​(Traversable<Pair<K,​V>> traversable)
      • factory

        @NotNull
        public static <K,​V> @NotNull BuilderFactory<Pair<K,​V>,​Map<K,​V>> factory()
      • builder

        @NotNull
        public static <K,​V> @NotNull Builder<Pair<K,​V>,​Map<K,​V>> builder()