code: public BagObject getBagObject (String key, Supplier<BagObject> notFound) {
          Object object = getObject (key);
          return (object instanceof BagObject) ? (BagObject) object : notFound.get ();
      }
docs: Retrieve a mapped element and return it as a BagObject.
  
  @param key A string value used to index the element.
  @param notFound A function to create a new BagObject if the requested key was not found
  @return The element as a BagObject, or notFound if the element is not found.