Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/a-cordier/design-pattern-ngleton

Provide n ready made instances of an object using static final references and a private constructor
https://github.com/a-cordier/design-pattern-ngleton

Last synced: 14 days ago
JSON representation

Provide n ready made instances of an object using static final references and a private constructor

Awesome Lists containing this project

README

        

# "NGleton" using static final instances

# Provide n ready made instances of an object using static final references and a private constructor

```java

private String name;
private Integer value;

public static final NGleton instanceOne =
new NGleton("One", 1);

public static final NGleton instanceTwo =
new NGleton("two", 2);

private NGleton(String name, Integer value) {
this.name = name;
this.value = value;
}
```