| Summary: | Incorrect method realization | ||
|---|---|---|---|
| Product: | Chinese Checker | Reporter: | yutongmen2-c |
| Component: | Algorithm Component | Assignee: | yutongmen2-c |
| Status: | CONFIRMED --- | ||
| Severity: | normal | CC: | yutongmen2-c |
| Priority: | --- | ||
| Version: | unspecified | ||
| Hardware: | All | ||
| OS: | All | ||
|
Description
yutongmen2-c
2021-11-11 14:24:17 HKT
Wrong implementation:
public static Graph getInstance() {
if (instance != null) {
return instance;
} else {
return new Graph();
}
if (instance == null)
instance = new Graph();
return instance;
}
Correct implementation:
public static Graph getInstance() {
if (instance == null)
instance = new Graph();
return instance;
}
|