IntArray.filter(), .sorted() 를 거치면 List<Int> 가 된다.

shin_stealer·2025년 7월 6일
0

IntArray.filter(), .sorted() 를 거치면 List 가 된다.

IntArray -> primitive type, 기본 타입 배열, 즉 int[] 임.

  • IntArray 는 Iterable 가 아님.
  • 하지만 kotlin 에서 filter 는 IntArray 에 대해 List 를 반환하도록 오버로드 되어있음.
    val filtered = arr.filter { it % 5 == 0 } // 타입: List<Int>
profile
I am a Blacksmith.

0개의 댓글