Is there such?

ps similar effect can be achieved somehow like this:

Map<Integer,Integer[]> map; map.set(1, (new Integer[n]) ); //то самое n 

But somehow not very convenient

    1 answer 1

    You probably need a Multimap . There is no embedded solution, but Oracle offers essentially the same thing as you, only they have a List instead of an array (see here , scroll down to Multimaps).


    There are also many 3rdparty implementations, easy to googling .

    • Yes, like it, thank you. - kandi
    • You are welcome! - VladD
    • By the way, you can explain why not an array, but a sheet. If v are of different types - the array will not save - kandi
    • Well, it is possible on Object[] . But: you can add elements to the List gradually, and with an array you need to know in advance how many there will be. - VladD