Skip to content

Commit

Permalink
Fix small static bug
Browse files Browse the repository at this point in the history
  • Loading branch information
igr committed Apr 17, 2023
1 parent bce2775 commit 9e373de
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 14 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ repositories {


group = 'com.oblac'
version = '2.2.0'
version = '2.2.1'

java {
sourceCompatibility = JavaVersion.VERSION_1_8
Expand Down
26 changes: 13 additions & 13 deletions src/main/java/com/oblac/nomen/Nomen.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,14 @@ public class Nomen {

protected LinkedList<Supplier<String>> template = new LinkedList<>();

protected final Supplier<String> ADJECTIVES = () -> randomValueFrom(rnd, Adjectives.LIST);
protected final Supplier<String> ANIMALS = () -> randomValueFrom(rnd, Animals.LIST);
protected final Supplier<String> COLORS = () -> randomValueFrom(rnd, Colors.LIST);
protected final Supplier<String> NOUNS = () -> randomValueFrom(rnd, Nouns.LIST);
protected final Supplier<String> PEOPLE = () -> randomValueFrom(rnd, People.LIST);
protected final Supplier<String> POKEMON = () -> randomValueFrom(rnd, Pokemon.LIST);
protected final Supplier<String> SUPERB = () -> randomValueFrom(rnd, Superb.LIST);
protected final Supplier<String> SUPERHERO = () -> randomValueFrom(rnd, Superheroes.LIST);
protected final Supplier<String> ADJECTIVES = () -> randomValueFrom(Adjectives.LIST);
protected final Supplier<String> ANIMALS = () -> randomValueFrom(Animals.LIST);
protected final Supplier<String> COLORS = () -> randomValueFrom(Colors.LIST);
protected final Supplier<String> NOUNS = () -> randomValueFrom(Nouns.LIST);
protected final Supplier<String> PEOPLE = () -> randomValueFrom(People.LIST);
protected final Supplier<String> POKEMON = () -> randomValueFrom(Pokemon.LIST);
protected final Supplier<String> SUPERB = () -> randomValueFrom(Superb.LIST);
protected final Supplier<String> SUPERHERO = () -> randomValueFrom(Superheroes.LIST);

protected String space = "-";
protected String separator = "_";
Expand Down Expand Up @@ -60,11 +60,11 @@ public Nomen literal(final String literal) {
}

public Nomen random(final List<String> strings) {
template.add(() -> randomValueFrom(rnd, strings));
template.add(() -> randomValueFrom(strings));
return this;
}
public Nomen random(final String... strings) {
template.add(() -> randomValueFrom(rnd, strings));
template.add(() -> randomValueFrom(strings));
return this;
}

Expand Down Expand Up @@ -243,16 +243,16 @@ private static String replace(String s, String sub, String with) {
* @param list array of strings
* @return random string from given array
*/
private String randomValueFrom(Random rnd, String... list) {
private String randomValueFrom(String... list) {
final int index = rnd.nextInt(list.length);

return list[index];
}
private String randomValueFrom(Random rnd, List<String> list) {
private String randomValueFrom(List<String> list) {
final int index = rnd.nextInt(list.size());

return list.get(index);
}

private static Random rnd = new Random();
private Random rnd = new Random();
}

0 comments on commit 9e373de

Please sign in to comment.