The danger of asFlow() when converting Rx to CoroutinesRecently I ran into an ANR crash on Android, and it turned out the culprit is asFlow() in the kotlinx:kotlinx-coroutines-rx2 library when…Dec 4, 20231Dec 4, 20231
Kotlin Coroutines GotchasSimplest use case: suspend functions, does async jobs sequentially.Sep 30, 2022Sep 30, 2022
When WeakHashMap leaksWeakHashMap is used to avoid memory leaks, but there is a catch: the weak reference is on the key, not the value.Aug 4, 2020Aug 4, 2020
Naming a CaptureCaptures Optional variables and name the captured variable foo .Oct 17, 2019Oct 17, 2019
One Caveat of Generics in SwiftRecently I was wondering how to implement PECS (Producers Extends Consumers Super) in Swift, and it turned out I could not.Aug 11, 20181Aug 11, 20181
Published inHackerNoon.comJava bits: 0xFF and 0xFFLI wrote a method to read a long typed number from an InputStream. The code is as follows:Oct 31, 2017Oct 31, 2017
Published inAndroidPubJava: When to Use (n >> 8) & 0xff and When to Use (byte)(n >>> 8)IntroductionOct 25, 2017Oct 25, 2017
Published inAndroidPubA Comparison of Performances between TreeMap and PriorityQueue in One Use CaseUse CaseOct 9, 20171Oct 9, 20171
How to make RxJava’s repeatWhen and retryWhen work with SubjectsRecently we have a requirement to retry a network request after failures so I looked it up on the web and found that RxJava’s retryWhen…Jul 13, 20171Jul 13, 20171
Published inHackerNoon.comBrief introduction to AbstractQueuedSynchronizer by Using a Simple Mutex ExampleAbstractQueuedSynchronizer is a masterpiece java class authored by Doug Lea. It is the underlying data structure that provides the acquire…Jun 4, 2017Jun 4, 2017