Created
October 10, 2019 05:22
-
-
Save alvindizon/4e9fd9a11c4478cea9db14f3b0b0797e to your computer and use it in GitHub Desktop.
safe lazy initialization example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class UDPClient { | |
private static final String TAG = UDPClient.class.getSimpleName(); | |
private static class Holder{ | |
public static UDPClient udpClient = new UDPClient(); | |
} | |
public static UDPClient getUdpClient() { | |
return Holder.udpClient; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment