Kotlin 표준함수인 apply, let , run, with, also, takeIf의 정의와 사용예를 기술한다. apply apply 함수는 객체에 method들을 호출 하고, 그 객체를 return 한다. let
List는 kotlin Collection Type중의 하나로 순서가 있는 Element의 목록이다.list가 empty 인 경우 fisrt()는 NoSuchElementException, 0 은 IndexOutOfException이 발생한다. 안전한 코딩을 위해선 f
shuffled()는 list를 shuffle한 결과를 새로운 list로 반환한다.shuffle()은 list를 shuffle한 결과를 object에 저장한다. list값이 변경되기에 mutableList에서만 사용가능 하다.
Kotlin 언어는 Singletone을 구현하는 언어 차원에서 제공한다. 바로 object keyword를 사용한다.$ before use $ init fun has been calledinit method는 최초 Singletone Object가 사용되는 시점에 호
kotlin에는 data를 담는 class를 위한 data keyword가 존재한다.equals, copy, toString, componentN method를 자동으로 구현한다.componentN method가 구현되어 있기 때문에, destructing 문법을 사용