2015-05-05 11:20:13 -07:00
|
|
|
//: references/ImmutableInteger.java
|
|
|
|
// The Integer class cannot be changed.
|
|
|
|
import java.util.*;
|
|
|
|
|
|
|
|
public class ImmutableInteger {
|
|
|
|
public static void main(String[] args) {
|
2015-05-06 15:14:33 -07:00
|
|
|
List<Integer> v = new ArrayList<>();
|
2015-05-05 11:20:13 -07:00
|
|
|
for(int i = 0; i < 10; i++)
|
|
|
|
v.add(new Integer(i));
|
2015-05-18 23:05:20 -07:00
|
|
|
// But how do you change the int
|
|
|
|
// inside the Integer?
|
2015-05-05 11:20:13 -07:00
|
|
|
}
|
|
|
|
} ///:~
|