Other |
---|
tbdUnresolved |
Duplicate :
|
|
Duplicate :
|
|
Relates :
|
|
Relates :
|
|
Relates :
|
|
Relates :
|
|
Relates :
|
|
Relates :
|
|
Relates :
|
|
Relates :
|
|
Relates :
|
|
Relates :
|
|
Relates :
|
|
Relates :
|
|
Relates :
|
|
Relates :
|
|
Relates :
|
|
Relates :
|
|
Relates :
|
|
Relates :
|
|
Relates :
|
One would think that the following program --------------------------- import java.util.*; public class Bug { static void test(String... elts) { Set<String> s = new TreeSet<String>(String.CASE_INSENSITIVE_ORDER); s.addAll(Arrays.asList("a", "b")); s.removeAll(Arrays.asList(elts)); System.out.println(s); } public static void main(String[] args) { test("A"); test("A", "C"); } } --------------------------- would print 2 identical lines, but in fact it prints [b] [a, b] The results are dependent on the relative sizes of the two sets, violating the Principle of Least Astonishment.
|