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. static class Test
  11. {
  12.  
  13. }
  14. public static void main (String[] args) throws java.lang.Exception
  15. {
  16. List<Test> mLinks = new ArrayList<Test>();
  17. mLinks.add(new Test());
  18. mLinks.add(new Test());
  19. Integer i = 1;
  20. System.out.println("before: " + mLinks.size());
  21. mLinks.remove(i);
  22. System.out.println("after1: " + mLinks.size());
  23. mLinks.remove((int)i);
  24. System.out.println("after2: " + mLinks.size());
  25. }
  26. }
Success #stdin #stdout 0.1s 321600KB
stdin
Standard input is empty
stdout
before: 2
after1: 2
after2: 1