# OnnxMap (onnxruntime 1.15.0 API)

Package ai.onnxruntime

## Class OnnxMap

- java.lang.Object
- - ai.onnxruntime.OnnxMap

All Implemented Interfaces:
  `OnnxValue`, `java.lang.AutoCloseable`

    public class OnnxMap
    extends java.lang.Object
    implements OnnxValue

A container for a map returned by `OrtSession.run(Map)`.

Supported types are those mentioned in "onnxruntime_c_api.h", keys: String and Long, values: String, Long, Float, Double.

### Nested Class Summary

Nested Classes
`static class` `OnnxMap.OnnxMapValueType` An enum representing the Java type of the values stored in an `OnnxMap`.

### Nested classes/interfaces inherited from interface ai.onnxruntime.OnnxValue

`OnnxValue.OnnxValueType`

### Method Summary

All Methods Instance Methods Concrete Methods
`void` `close()` Closes this map, releasing the native memory backing it and it's elements.
`MapInfo` `getInfo()` Gets the type info object associated with this OnnxValue.
`OnnxValue.OnnxValueType` `getType()` Gets the type of this OnnxValue.
`java.util.Map<? extends java.lang.Object,​? extends java.lang.Object>` `getValue()` Returns a weakly typed Map containing all the elements.
`int` `size()` The number of entries in the map.
`java.lang.String` `toString()`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

### Method Detail

#### size

    public int size()

The number of entries in the map.

Returns:
  The number of entries.

#### getType

    public OnnxValue.OnnxValueType getType()

Description copied from interface: `OnnxValue`
Gets the type of this OnnxValue.

Specified by:
  `getType` in interface `OnnxValue`
Returns:
  The value type.

#### getValue

    public java.util.Map<? extends java.lang.Object,​? extends java.lang.Object> getValue()
                                                                                        throws OrtException

Returns a weakly typed Map containing all the elements.

Specified by:
  `getValue` in interface `OnnxValue`
Returns:
  A map.
Throws:
  `OrtException` - If the onnx runtime failed to read the entries.

#### getInfo

    public MapInfo getInfo()

Description copied from interface: `OnnxValue`
Gets the type info object associated with this OnnxValue.

Specified by:
  `getInfo` in interface `OnnxValue`
Returns:
  The type information.

#### toString

    public java.lang.String toString()

Overrides:
  `toString` in class `java.lang.Object`

#### close

    public void close()

Closes this map, releasing the native memory backing it and it's elements.

Specified by:
  `close` in interface `java.lang.AutoCloseable`
Specified by:
  `close` in interface `OnnxValue`