Java HashSet and data type Short, incompatibility ?

Posted by Emerald on Stack Overflow See other posts from Stack Overflow or by Emerald
Published on 2010-06-07T08:57:52Z Indexed on 2010/06/07 9:02 UTC
Read the original article Hit count: 477

Filed under:
|
|

public class SomeSet {

    public static void main(String[] args) {

        Set<Short> s = new HashSet<Short>();

        for (short i = 0; i < 100; i++) {

            s.add(i);

            s.remove(i - 1);

        }

        System.out.println(s.size());

    }

}

Why does it print like that ?

© Stack Overflow or respective owner

Related posts about java

Related posts about hashset