Skip to content

Instantly share code, notes, and snippets.

@TGITS
Last active May 17, 2023 13:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save TGITS/cd96de37618a51f3c7caa2891db92d7d to your computer and use it in GitHub Desktop.
Save TGITS/cd96de37618a51f3c7caa2891db92d7d to your computer and use it in GitHub Desktop.
Exemple de séquence factice utilisant plusieurs instance de Supplier
//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