Last active
August 31, 2022 07:47
-
-
Save mono0926/07644fe82c8d1d744b55ab20155c229d to your computer and use it in GitHub Desktop.
This file contains 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
// ignore_for_file: omit_local_variable_types, prefer_final_locals, equal_elements_in_set | |
import 'dart:collection'; | |
void main() { | |
// Setのデフォルト実装は、順番が保たれる LinkedHashSet | |
Set<String> animals = {'dog', 'dog', 'cat'}; | |
// 常に[dog, cat] | |
print(animals.toList()); | |
Set<String> animals2 = HashSet.of(['dog', 'dog', 'cat']); | |
// 不定(手元では常に[cat, dog]になったが不確実) | |
print(animals2.toList()); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment