Interface MappableTensor<V>

  • Type Parameters:
    V - the type of the values of the tensors
    All Superinterfaces:
    Tensor<V>, Tensoric<V>

    public interface MappableTensor<V>
    extends Tensor<V>
    Enhances the tensor interface by 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 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)