mino   9년 전

흠....어디가 잘못됐는지 모르겠네요ㅜㅜ

기본적으로 HashSet에 넣어서 순서대로 출력을 한건데

틀리다고 나오네요. 데이터는 중복되는게 안들어 오니 문제가 없다고 생각하는데...

뭐가 잘못된걸까요?

자바 사용하는 분들 도움을 주시면 안될까요ㅜㅜ

algoshipda   9년 전

TreeSet으로 하니깐 되네요.

http://docs.oracle.com/javase/8/docs/api/ 에서보니

It makes no guarantees as to the iteration order of the set; in particular, it does not guarantee that the order will remain constant over time.

랍니다.

mino   9년 전

@s201124481

오....감사합니다.

c++ 생각하고 set이면 그냥 정렬이 되어있을거라고 생각한게 문제였네요.

앞으로 자세히 알아보고 사용을 해야겠네요ㅋㅋ

댓글을 작성하려면 로그인해야 합니다.