Skip to content
This repository has been archived by the owner on Mar 25, 2024. It is now read-only.

Android Basics: Collections #58

Closed
mesoclever opened this issue Mar 2, 2021 · 1 comment
Closed

Android Basics: Collections #58

mesoclever opened this issue Mar 2, 2021 · 1 comment
Assignees
Labels
invalid This doesn't seem right

Comments

@mesoclever
Copy link

URL of codelab
https://developer.android.com/codelabs/basic-android-kotlin-training-collections?continue=https%3A%2F%2Fdeveloper.android.com%2Fcourses%2Fpathways%2Fandroid-basics-kotlin-unit-3-pathway-1%23codelab-https%3A%2F%2Fdeveloper.android.com%2Fcodelabs%2Fbasic-android-kotlin-training-collections#1

In which task and step of the codelab can this issue be found?
Task 2 : Learn about collections

Describe the problem
The codelab is demonstrating the usage of the contains functions for the sets.
It makes use of this line:
println("contains 7: ${setOfNumbers.contains(7)}")
Which results in a Unresolved reference error.

Steps to reproduce?
Running the code listed in the codelab.

fun main() {
    val numbers = listOf(0, 3, 8, 4, 0, 5, 5, 8, 9, 2)
    println("list:   ${numbers}")
    println("sorted: ${numbers.sorted()}")
    val setOfNumbers = numbers.toSet()
    println("set:    ${setOfNumbers}")
    val set1 = setOf(1,2,3)
    val set2 = mutableSetOf(3,2,1)
    println("$set1 == $set2: ${set1 == set2}")
    println("contains 7: ${setOfNumbers.contains(7)}")
}
@android-dev-lxl android-dev-lxl self-assigned this Mar 2, 2021
@android-dev-lxl android-dev-lxl added the invalid This doesn't seem right label Mar 2, 2021
@android-dev-lxl
Copy link
Contributor

@suracoza
Thank you for reaching out to us.
We checked the code given by you, it is compiling with out any issues.
Please refer to the following screenshot.
Link to the code in Kotlin playground: https://pl.kotl.in/HvQsF2Y0l
Please cross check the variable name, setOfNumbers.

image

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
invalid This doesn't seem right
Projects
None yet
Development

No branches or pull requests

2 participants