daily pastebin goal
20%
SHARE
TWEET

Untitled

a guest Mar 20th, 2019 52 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. private void writeToCSV(List<Employee> empList) {
  2.     try(BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(
  3.                 new FileOutputStream(System.getProperty("java.io.tmpdir")+"Test.csv"), "UTF-8"))) {
  4.         empList.forEach(eachEmployee -> {
  5.             StringBuilder builder = new StringBuilder();
  6.             builder.append(eachEmployee.getName());
  7.             builder.append(CSV_SEPARATOR);
  8.             builder.append(eachEmployee.getID());
  9.             builder.append(CSV_SEPARATOR);
  10.             builder.append(eachEmployee.getJoiningDate());
  11.             writer.write(builder.toString());
  12.             writer.newLine();
  13.         });
  14.     }
  15. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top