Package tenapull.util

Class MakeMap

java.lang.Object
tenapull.util.MakeMap

public class MakeMap
extends java.lang.Object
Static utility for making a map from an array of Objects. Used as a substitute for Map.of() since that throws exceptions if any of the arguments are null
  • Constructor Summary

    Constructors 
    Constructor Description
    MakeMap()  
  • Method Summary

    Modifier and Type Method Description
    static java.util.LinkedHashMap of​(java.lang.Object[] entries)
    Creates a map from the passed array of Objects {key1, value1, key2, value2, etc...}

    Methods inherited from class java.lang.Object

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

  • Method Details

    • of

      public static java.util.LinkedHashMap of​(java.lang.Object[] entries) throws java.lang.IllegalArgumentException
      Creates a map from the passed array of Objects {key1, value1, key2, value2, etc...}
      Parameters:
      entries - key-value pairs to construct the map with
      Returns:
      the constructed map
      Throws:
      java.lang.IllegalArgumentException - if the entries array has an odd-numbered length