How to make a column allow as a null in my sql

ALTER TABLE mytable MODIFY mycolumn VARCHAR(30);

Advertisements

Multiple Keys to Single Value Map Java

It sounds to me like you’re looking for a nested HashMap. This could work, but my gut says implementing such a monster would be a terrible idea, both performance-wise and sanity-wise.

How you could initialize it:

    HashMap<Key1, HashMap<Key2, Value>> nestedHashMap = new HashMap<Key1, HashMap<Key2, Value>>();

Adding values:

    Key1 first;
    Key2 second;
    Value data;
    HashMap<Key2, Value> tempMap = new HashMap<Key2, Value>();
    tempMap.put(second, data);
    nestedHashMap.put(first, tempMap);

Getting data back out:

    Key1 first;
    Key2 second;
    Value data;
    data = nestedHashMap.get(first).get(second);

Disclaimer: This code hasn’t been tested, it just came off the top of my head.