Reputation: 265
If i need make value of two data, almost I using map
And I knew a tuple that could be used similarly.
what's different of tuple, pair, map?
Upvotes: 2
Views: 3568
Reputation: 45750
This will be language dependent, as all languages use slightly different terminology.
Generally though
a tuple is a structure that can hold an arbitrary number of values, but only an amount fixed at creation time (unlike a list that can be extended after creation).
a pair is a tuple that only holds two values.
a map is a structure that (conceptually) holds multiple pairs and allows efficient lookups by the first element in the pair (the key). They also do not allow the first elements of any pairs to be the same.
Upvotes: 2