Skip to content

Instantly share code, notes, and snippets.

@mono0926
Last active August 31, 2022 07:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mono0926/07644fe82c8d1d744b55ab20155c229d to your computer and use it in GitHub Desktop.
Save mono0926/07644fe82c8d1d744b55ab20155c229d to your computer and use it in GitHub Desktop.
// 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