Created
April 27, 2011 13:49
-
-
Save amay077/944277 to your computer and use it in GitHub Desktop.
froyo と Gingerbread の違い
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public class Hoge { // implements Comparable してない | |
| private int num = 0; | |
| public Hoge(int num) { this.num = num; } | |
| } | |
| @Override | |
| public void onCreate() { | |
| Set<Hoge> hogeSet = new TreeSet<Hoge>(); | |
| hogeSet.add(new Hoge(1)); // ← Gingerbread だとここで例外 | |
| hogeSet.add(new Hoge(2)); // ← froyo 以前だとここで例外 | |
| } |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Comparable を実装してないクラスを TreeSet または TreeMap に add (or put) すると、
という違いがありました。