Advertisement
Guest User

Untitled

a guest
Jan 7th, 2021
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Kotlin 0.41 KB | None | 0 0
  1.     companion object {
  2.         @Volatile
  3.         private var instances = arrayOfNulls<MessagesController>(UserConfig.MAX_ACCOUNT_COUNT)
  4.  
  5.         @JvmStatic
  6.         @NotNull
  7.         fun getInstance(num: Int) = instances[num]
  8.                 ?: synchronized(MessagesController::class.java) {
  9.                     instances[num] ?: MessagesController(num).also { instances[num] = it }
  10.                 }
  11.     }
  12.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement