google-developer-training / android-fundamentals-apps-v2

Other
649 stars 2.63k forks source link

Android Kotlin Fundamentals codelab: 10.1 task 5 #226

Closed bbura closed 1 year ago

bbura commented 3 years ago

Describe the problem Here is a double and unnecessary check for null.

In which lesson and step of the codelab can this issue be found? https://developer.android.com/codelabs/android-training-livedata-viewmodel?authuser=0#6

Ex: 5.1.4

public static WordRoomDatabase getDatabase(final Context context) { if (INSTANCE == null) { synchronized (WordRoomDatabase.class) { if (INSTANCE == null) { // Create database here } } } return INSTANCE; }