The below code shows hot to read the list of resources(files) from a classpath folder and subfolder.Below is the example code
import java.io.*;
import java.net.URL;
import java.nio.file.Files;
import java.util.*;
public class ReadResourceFiles {
public static void main(String[] args) throws IOException {
...
Showing posts with label Java 8. Show all posts
Showing posts with label Java 8. Show all posts
undefined
202
Before going further lets talk about Log Forging or JVM Log Forging. Log ForgingAccording to OWASP , writing invalidated logs can allow attackers to forge log or inject malicious content in log file. Log forging is when attackers tries to add/modify the log content by exploring the security loopholes of...
undefined
202
The ExecutorService interface, executes tasks in parallel in background and represents an asynchronous execution mechanism. The ExecutorService create and maintain the reusable thread pool.How to create ExecutorService?To create ExecutorService, you can use Executors factory to create the instance of ExecutorService....
undefined
201
Lets se how we can sort the object by using java 8 lambda comparator. For this let take a Employee class.
public class Employee {
private String name;
private int salary;
// standard constructors, getters/setters, equals and hashcode
}
1. Classic sort (without lambda)
Comparator< Employee...