Here I am demonstrating how to read / parse CSV file using java scanner
For example my csv file (user.csv) looks like below.
Rockey,22,India Bill,23,US Sonia,23,Germany
Now I am creating java class for mapping the above fields in csv file.
Memory leaks doesn't have to be hard/scary/tedious problem to solve, if you follow below mentioned 3 simple steps:
Step 1: Capture baseline heap dump
You need to capture heap dump when it’s in healthy state. Start your application. Let it take real traffic for 10 minutes. At this point capture heap dump. Heap Dump is basically snapshot of your memory. It contains all objects that are residing in the memory, values stored in those objects, inbound & outbound references of those object. You can capture Heap dump can be captured using following command:
jmap -dump:format=b,file=<file-path> <pid>
pid: is the Java Process Id, whose heap dump should be captured
file-path: is the file path where heap dump will be written in to.
Timely upgrades can be proved a strategic move towards lifting the operational excellence to the next level. Experienced management individuals know very well that how the essential pieces of functionalities can greatly improve performance of process along with addressing the security challenges. Hence, they favor the technology upgrades anticipating reasonable amount of Return on Investment (ROI).
As Liferay DXP is a revolutionary version of Liferay enterprise portal launched in 2016, lot many organizations would rather opt for upgrading to Liferay DXP.
In this tutorial, I am showing how to iterate through a HashMap using java in different useful ways.
If you are using Java 8 for the map iteration, you can use lambda expression as like method 5.
You can also use with generics as method 3, and without generics as method 4, if you are using old versions of jdk.
In this tutorial, I am showing how to convert Java InputStream to String using Plain Java, Java 8, Apache Commons IO library and Guava.
is connected to some data streams
like a file, memory
connection, pipe etc. It is
used for reading the data from above sources.
In this tutorial, I am showing how to Create ArrayList from array using java in different useful ways.
1) You can use Arrays.asList(array) to convert an array to an
2) If you are working with java 8 you can use stream api Stream.of(array).collect(Collectors.toCollection(ArrayList::new))
3) If you are working with java 9 you can use List.of("Hello", "World"), where this list is backed by an array.
In this example, I am showing How can I test if an array contains a certain value efficiently
In java 8 you can use Stream.of(array).anyMatch(x -> x == "world") for checking for string value (Example 1) .If it is integer value you can use IntStream.of(array2).anyMatch(x -> x == 0) (Example 2)
In java old version you can use Arrays.toString(array) to checking for string values (Example 3)