list initialization code example
Example 1: initialize a list of list in python
x = [[] for i in range(3)]
Example 2: initialise List>
List> list = new ArrayList>();
##or since Java 1.7
List> list = new ArrayList<>();
Example 3: python initialize list
# Creating an empty list
lst = []
# Creating a list with elements
lst = [1, 2, 3, 4, 5]
Example 4: c++ initialization list
class Something
{
private:
int m_value1;
double m_value2;
char m_value3;
public:
Something()
{
// These are all assignments, not initializations
m_value1 = 1;
m_value2 = 2.2;
m_value3 = 'c';
}
};