fork download
  1. /* package whatever; // don't place package name! */
  2.  
  3. import java.util.*;
  4. import java.lang.*;
  5. import java.io.*;
  6.  
  7. /* Name of the class has to be "Main" only if the class is public. */
  8. class Ideone
  9. {
  10. public static void main (String[] args) throws java.lang.Exception
  11. {
  12. Map<Integer, IntegerArray> mp = new HashMap<Integer, IntegerArray>();
  13. mp.put(1, new IntegerArray(1, 2));
  14. mp.put(2, new IntegerArray(2, 3));
  15. mp.put(3, new IntegerArray(3, 4));
  16.  
  17. System.out.println(mp);
  18. }
  19. }
  20.  
  21. class IntegerArray {
  22. int[] array;
  23.  
  24. IntegerArray(int... array){
  25. this.array = array;
  26. }
  27.  
  28. @Override
  29. public String toString(){
  30. return Arrays.toString(array);
  31. }
  32. }
Success #stdin #stdout 0.09s 27740KB
stdin
Standard input is empty
stdout
{1=[1, 2], 2=[2, 3], 3=[3, 4]}