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. // your code goes here
  13. Map<Integer, int[]> map = new HashMap<>();
  14. map.put(1, new int[] {1, 2});
  15. map.put(2, new int[]{2, 3});
  16.  
  17. int[] arr = map.get(2);
  18. arr[1] = 10;
  19.  
  20. for (Map.Entry<Integer, int[]> kv : map.entrySet()) {
  21. System.out.print(kv.getKey() + " : ");
  22. for (int i = 0; i < kv.getValue().length; i++) {
  23. System.out.print(kv.getValue()[i] + ", ");
  24. }
  25. System.out.println();
  26. }
  27. }
  28. }
Success #stdin #stdout 0.13s 55440KB
stdin
Standard input is empty
stdout
1 : 1, 2, 
2 : 2, 10,