How-to articles, tricks, and solutions about TUPLES
Convert list to tuple in Python
You can convert a list to a tuple in Python by using the built-in tuple() function.
How to sort a list/tuple of lists/tuples by the element at a given index?
You can use the sorted() function with the key parameter to specify a function that extracts the element at the desired index.
Using Pairs or 2-tuples in Java
In Java, you can use the javafx.util.Pair class to represent a pair or 2-tuple.
What are "named tuples" in Python?
"Named tuples" in Python are a subclass of the built-in tuple type, but with the added ability to access elements by name rather than just by index.
What is the equivalent of the C++ Pair<L,R> in Java?
In Java, the equivalent of the C++ Pair class is the AbstractMap.SimpleEntry class or the AbstractMap.SimpleImmutableEntry class.
What's the difference between lists and tuples?
Lists and tuples are both used to store multiple items in a single variable, but they are different in a few key ways.