If a table's
isRandom
method returns true, then it is possible to access the cells of a
table in any order.
The most straightforward way to do this is using the
getCell
or getRow
methods directly on the table itself (not on a RowSequence
).
These methods are supposed to be in general safe for use
from multiple threads concurrently;
however depending on the implementation that may be enforced in
a way that slows down concurrent access, for instance using synchronization.
The preferred alternative in multithreaded contexts is to use the
getRowAccess
method to obtain a RowAccess
object.
A RowAccess
can be used for random access within a single thread,
in a way that may (depending on the implementation)
avoid contention for resources.
Similar comments about whether to use the by-cell or by-row methods apply as in the previous section.
If an attempt is made to call these random access methods
on a non-random table
(one for which isRandom()
returns false
),
an
UnsupportedOperationException
will be thrown.