File tree Expand file tree Collapse file tree
src/main/java/net/datafaker/providers/base Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -134,8 +134,8 @@ public String bic() {
134134 */
135135 public String iban () {
136136 List <String > countryCodes = new ArrayList <>(countryCodeToBasicBankAccountNumberPattern .keySet ());
137- String randomCountryCode = countryCodes . get ( faker .random ().nextInt (countryCodes . size ()) );
138- return iban (randomCountryCode );
137+ String countryCode = faker .options ().nextElement (countryCodes );
138+ return iban (countryCode );
139139 }
140140
141141 /**
Original file line number Diff line number Diff line change 11package net .datafaker .providers .base ;
22
3- import java .nio .charset .Charset ;
4- import java .nio .charset .StandardCharsets ;
53import java .util .Locale ;
64
75/**
86 * @since 0.8.0
97 */
108public class Nation extends AbstractProvider <BaseProviders > {
11-
12- private static final Charset UTF8_CHARSET = StandardCharsets . UTF_8 ;
9+ private static final String [] isoLanguages = Locale . getISOLanguages ();
10+ private static final String [] isoCountries = Locale . getISOCountries () ;
1311
1412 protected Nation (BaseProviders faker ) {
1513 super (faker );
@@ -32,12 +30,10 @@ public String flag() {
3230 }
3331
3432 public String isoLanguage () {
35- String [] isoLangs = Locale .getISOLanguages ();
36- return isoLangs [faker .random ().nextInt (isoLangs .length )];
33+ return faker .options ().option (isoLanguages );
3734 }
3835
3936 public String isoCountry () {
40- String [] isoCountries = Locale .getISOCountries ();
41- return isoCountries [faker .random ().nextInt (isoCountries .length )];
37+ return faker .options ().option (isoCountries );
4238 }
4339}
Original file line number Diff line number Diff line change @@ -49,7 +49,7 @@ public String sibling() {
4949 }
5050
5151 public String any () {
52- Kind kind = faker .options ().option (Kind .values () );
52+ Kind kind = faker .options ().option (Kind .class );
5353 return resolve (kind .expression );
5454 }
5555
Original file line number Diff line number Diff line change @@ -79,7 +79,7 @@ public String romeoAndJulietQuote() {
7979 }
8080
8181 private String randomElement (String [] values ) {
82- return values [ faker .random ().nextInt (values . length )] ;
82+ return faker .options ().option (values ) ;
8383 }
8484
8585}
Original file line number Diff line number Diff line change @@ -53,11 +53,11 @@ public int messagingPort() {
5353 * @return an RTP UDP 5 digit port int, e.g. 40002.
5454 */
5555 public int rtpPort () {
56- return portPool [ faker .random ().nextInt (portPool . length )] ;
56+ return faker .options ().option (portPool ) ;
5757 }
5858
5959 /**
60- * Proviosional code, the various response codes are listed in
60+ * Provisional code, the various response codes are listed in
6161 * <a href="https://en.wikipedia.org/wiki/List_of_SIP_response_codes">https://en.wikipedia.org/wiki/List_of_SIP_response_codes</a>.
6262 *
6363 * @return a 3 digit SIP provision response code between 100 and 199 int, e.g. {@code 180}.
@@ -117,7 +117,7 @@ public int globalErrorResponseCode() {
117117 }
118118
119119 /**
120- * Proviosional phrase, the various response phrases are listed in
120+ * Provisional phrase, the various response phrases are listed in
121121 * <a href="https://en.wikipedia.org/wiki/List_of_SIP_response_codes">https://en.wikipedia.org/wiki/List_of_SIP_response_codes</a>.
122122 *
123123 * @return a SIP provisional response phrase String, e.g. {@code Ringing}.
You can’t perform that action at this time.
0 commit comments