Tuple is a generic term taken from mathematics, which just means "several values in specific order". If you can say "give me 2nd value of this thing" then the thing is a tuple.
There is no single notation for them, but you can imagine that (1,2,3)
, ("a","b","c")
and ("John", "Smith", 12, false)
are all examples of tuples, having respectively 3, 3 and 4 items. Note that the idea of tuple puts no restrictions on the values, so they can have different types.
Technically a List
, String[]
and Vector
are all tuples. But in languages like Java, the term is used mostly when the items are of different types - otherwise we talk about sequences.
In libraries like JPA the term is used interchangebly with terms record and row. Tuples can be represented by special classes, but one way often used in Java is just to have an Object[]
.