Datasets:
ArXiv:
License:
Download data/test/Hugo-Gao/Design-pattern/Singleton/src/singleton/ChocolateBoiler.java from RepoFusion/Stack-Repo: direct link, hf CLI and curl.
- Browser
- Download file 596 Bytes
-
https://huggingface.co/datasets/RepoFusion/Stack-Repo/resolve/bbc90aef76314892f2d54f85da32b81503fb7eb3/data/test/Hugo-Gao/Design-pattern/Singleton/src/singleton/ChocolateBoiler.java
- Command line
-
hf download hf://datasets/RepoFusion/Stack-Repo@bbc90aef76314892f2d54f85da32b81503fb7eb3/data/test/Hugo-Gao/Design-pattern/Singleton/src/singleton/ChocolateBoiler.java
-
curl -L -o ChocolateBoiler.java https://huggingface.co/datasets/RepoFusion/Stack-Repo/resolve/bbc90aef76314892f2d54f85da32b81503fb7eb3/data/test/Hugo-Gao/Design-pattern/Singleton/src/singleton/ChocolateBoiler.java
596 Bytes
| package singleton; | |
| /** | |
| * Created by Administrator on 2017/6/19. | |
| */ | |
| public class ChocolateBoiler | |
| { | |
| private static ChocolateBoiler chocolateBoiler; | |
| private boolean isEmpty; | |
| private ChocolateBoiler() | |
| { | |
| isEmpty = true; | |
| System.out.println("Initial"); | |
| } | |
| public static ChocolateBoiler getInstance() | |
| { | |
| if (chocolateBoiler == null) | |
| { | |
| chocolateBoiler = new ChocolateBoiler(); | |
| } | |
| return chocolateBoiler; | |
| } | |
| public void fill() | |
| { | |
| if(isEmpty) | |
| { | |
| isEmpty = false; | |
| } | |
| } | |
| } | |