Last active
May 17, 2023 13:35
-
-
Save TGITS/cd96de37618a51f3c7caa2891db92d7d to your computer and use it in GitHub Desktop.
Exemple de séquence factice utilisant plusieurs instance de Supplier
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//DEPS net.datafaker:datafaker:1.9.0 | |
/** | |
* Pour executer avec JBang : jbang SeveralSuppliersCollectionExample.jsh | |
* <p> | |
* Pour exécuter sous JShell : | |
* jshell --class-path .;.\lib\datafaker-1.9.0.jar | |
* /open SeveralSuppliersCollectionExample.jsh | |
*/ | |
import net.datafaker.Faker; | |
import java.util.List; | |
Faker faker = new Faker(); | |
List<String> isbns = faker.<String>collection().suppliers(() -> faker.code().isbn10(true), () -> faker.code().isbn13(true)).len(10).generate(); | |
System.out.println("Printing ISBNs with 10 or 13 characters:"); | |
isbns.forEach(System.out::println); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment