Interface Mappable<V>

  • Type Parameters:
    V - the type of the values of the tensors
    All Known Implementing Classes:
    ImmutableTensor

    public interface Mappable<V>
    Allows its implementors to provide a method to view the tensor as a map from position to values. This interface is intended to be used by utility methods in order to avoid unnecessary calls.
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      java.util.Map<Position,​V> asMap()
      By implementing this method, a tensor can provide an efficient way to convert the tensor to a map from position to values.
    • Method Detail

      • asMap

        java.util.Map<Position,​V> asMap()
        By implementing this method, a tensor can provide an efficient way to convert the tensor to a map from position to values. Implementing instances must follow the following contract:
        • this method must not return null
        • It is recommended to return either a copy or an immutable map. Despite clients are not supposed to manipulate the returned maps, it cannot be guaranteed and this could lead to unexpected results.
        Usually, clients will not use this method directly, but should use TensorInternals.mapFrom(Tensor) (internal clients) or Tensorics.mapFrom(Tensor) (external clients)
        Returns:
        a (preferrably immutable) map representing the content of the tensor
        See Also:
        TensorInternals.mapFrom(Tensor), Tensorics.mapFrom(Tensor)