Skip to content

Commit ab88b11

Browse files
committed
#1604 simplify storing the flags
instead of storing sequence of unicode symbols for each flag, we can just store its emoji.
1 parent 0047804 commit ab88b11

File tree

2 files changed

+262
-2161
lines changed

2 files changed

+262
-2161
lines changed

src/main/java/net/datafaker/providers/base/Nation.java

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,7 @@
11
package net.datafaker.providers.base;
22

3-
import java.nio.ByteBuffer;
4-
import java.nio.MappedByteBuffer;
53
import java.nio.charset.Charset;
64
import java.nio.charset.StandardCharsets;
7-
import java.util.List;
85
import java.util.Locale;
96

107
/**
@@ -31,16 +28,7 @@ public String capitalCity() {
3128
}
3229

3330
public String flag() {
34-
@SuppressWarnings("unchecked")
35-
List<Integer> flagInts = (List<Integer>) faker.fakeValuesService().fetch("nation.flag", faker.getContext());
36-
37-
ByteBuffer byteBuffer = MappedByteBuffer.allocate(flagInts.size());
38-
39-
for (Integer flagInt : flagInts) {
40-
byteBuffer.put(flagInt.byteValue());
41-
}
42-
43-
return new String(byteBuffer.array(), UTF8_CHARSET);
31+
return resolve("nation.flag");
4432
}
4533

4634
public String isoLanguage() {

0 commit comments

Comments
 (0)