Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static void main(String[] args) {
- List<String> emails = Lists.newArrayList();
- emails.add("first-person@gmail.com");
- emails.add("second-person@gmail.com");
- emails.add("third-person@gmail.com");
- emails.add("fourth-person@gmail.com");
- emails.add("fifth-person@gmail.com");
- emails.add("sixth-person@gmail.com");
- emails.add("seventh-person@gmail.com");
- emails.add("eighth-person@gmail.com");
- :
- :
- for(String email: emails) {
- sendMail(email);
- }
- }
- private static void sendMail(final String email) {
- // function will call many other services for getting the information required for sending the email
- try {
- Thread.sleep(10000);
- System.out.println("ownerEmailDetail====>"+email);
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
- }
- public static void main(String[] args) {
- List<String> emails = Lists.newArrayList();
- emails.add("first-person@gmail.com");
- emails.add("second-person@gmail.com");
- emails.add("third-person@gmail.com");
- emails.add("fourth-person@gmail.com");
- emails.add("fifth-person@gmail.com");
- emails.add("sixth-person@gmail.com");
- emails.add("seventh-person@gmail.com");
- emails.add("eighth-person@gmail.com");
- :
- :
- emails.stream().parallel().forEach(email -> {
- System.out.println("given==>"+email);
- sendMail(email);
- });
- }
- private static void sendMail(final String email) {
- // function will call many other services for getting the information required for sending the email
- try {
- Thread.sleep(10000);
- System.out.println("ownerEmailDetail====>"+email);
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
- }
Add Comment
Please, Sign In to add comment