Size does matter vol 2
24 marca, 2012
2 komentarze
Czy rozmiar ma znaczenie?
- Co pojawi się na ekranie po uruchomieniu poniższego kodu?
public class SizeDoesMatterVol2 {
public static void main(String[] args) {
final List<Integer> elements = Arrays.asList(1, 2, 3);
final List<Integer> listOfInts = new ArrayList<Integer>(elements);
final Collection<Integer> collectionOfInts = new ArrayList<Integer>(elements);
listOfInts.remove(0);
collectionOfInts.remove(0);
System.out.println(listOfInts.size() == collectionOfInts.size());
}
}