Skip to content

Latest commit

 

History

History
10 lines (4 loc) · 798 Bytes

nio2.md

File metadata and controls

10 lines (4 loc) · 798 Bytes

Comparing old and new way of coding using new apis introduced in java8

Problem statement 1: How would you read a text file ? Check this for use of new Files.readAllLines which removes lots of boilerplate code from java7 approach.

Problem statement 2: Given a text file, skip the first line, change to upper-case and collect in a list. Check this for use of new Files.lines api which gives you stream out of file and Paths.get api to to locate a file in a file system.

Problem statement 3: How would you find the list of files in a directory.? Check this for use of new Files.list api which gives you stream of entries present in a directory.