Skip to content

Instantly share code, notes, and snippets.

@ezura
Created June 19, 2017 12:38
Show Gist options
  • Select an option

  • Save ezura/56357b4b8b8fb9eced76d821652ff3ac to your computer and use it in GitHub Desktop.

Select an option

Save ezura/56357b4b8b8fb9eced76d821652ff3ac to your computer and use it in GitHub Desktop.
Set(List とかでも) のインスタンスを作るとき、要素数によって、作られてる実態が違うみたい…? #CodePiece #kotlin
// elements.size == 0
object EmptySet : Set<Nothing>
// elements.size == 1
java.util.Collections.singleton(element)
// elements.size > 1
public typealias LinkedHashSet<E> = java.util.LinkedHashSet<E>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment