diff --git a/core-java-8/README.md b/core-java-8/README.md
index a78f99a416..9bb6bb811c 100644
--- a/core-java-8/README.md
+++ b/core-java-8/README.md
@@ -1,6 +1,6 @@
=========
-## Core Java Cookbooks and Examples
+## Core Java 8 Cookbooks and Examples
### Relevant Articles:
-// - [Jackson Ignore Properties on Marshalling](http://www.baeldung.com/jackson-ignore-properties-on-serialization)
+// - [Java 8 – Powerful Comparison with Lambdas](http://www.baeldung.com/java-8-sort-lambda)
diff --git a/core-java/README.md b/core-java/README.md
index a78f99a416..717008f507 100644
--- a/core-java/README.md
+++ b/core-java/README.md
@@ -3,4 +3,5 @@
## Core Java Cookbooks and Examples
### Relevant Articles:
-// - [Jackson Ignore Properties on Marshalling](http://www.baeldung.com/jackson-ignore-properties-on-serialization)
+- [Immutable ArrayList in Java](http://www.baeldung.com/java-immutable-list)
+- [Java - Reading a Large File Efficiently](http://www.baeldung.com/java-read-lines-large-file)
diff --git a/core-java/pom.xml b/core-java/pom.xml
index ff5f8b40df..ed3cb6ce43 100644
--- a/core-java/pom.xml
+++ b/core-java/pom.xml
@@ -22,6 +22,12 @@
4.0
+
+ commons-io
+ commons-io
+ 2.4
+
+
@@ -32,6 +38,31 @@
${jackson.version}
+
+
+
+ org.slf4j
+ slf4j-api
+ ${org.slf4j.version}
+
+
+ ch.qos.logback
+ logback-classic
+ ${logback.version}
+
+
+
+ org.slf4j
+ jcl-over-slf4j
+ ${org.slf4j.version}
+
+
+
+ org.slf4j
+ log4j-over-slf4j
+ ${org.slf4j.version}
+
+
@@ -101,7 +132,7 @@
4.3.0.Final
- 5.1.27
+ 5.1.28
2.3.0
diff --git a/core-java/src/test/java/org/baeldung/java/CoreJavaIoUnitTest.java b/core-java/src/test/java/org/baeldung/java/CoreJavaIoUnitTest.java
index 60bf6ee9a0..424621bc59 100644
--- a/core-java/src/test/java/org/baeldung/java/CoreJavaIoUnitTest.java
+++ b/core-java/src/test/java/org/baeldung/java/CoreJavaIoUnitTest.java
@@ -1,14 +1,82 @@
package org.baeldung.java;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.util.Scanner;
+
+import org.apache.commons.io.FileUtils;
import org.junit.Test;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.google.common.base.Charsets;
+import com.google.common.io.Files;
public class CoreJavaIoUnitTest {
+ protected final Logger logger = LoggerFactory.getLogger(getClass());
// tests -
@Test
- public final void whenIteratingAFile_thenCorrect() {
- //
+ public final void givenUsingGuava_whenIteratingAFile_thenCorrect() throws IOException {
+ final String path = "G:\\full\\train\\input\\" + "trainDataNegative.csv";
+ // final String path = "G:\\full\\train\\input\\" + "trainDataPositive.csv";
+
+ logMemory();
+ Files.readLines(new File(path), Charsets.UTF_8);
+ logMemory();
+ }
+
+ @Test
+ public final void givenUsingCommonsIo_whenIteratingAFile_thenCorrect() throws IOException {
+ final String path = "G:\\full\\train\\input\\" + "trainDataNegative.csv";
+ // final String path = "G:\\full\\train\\input\\" + "trainDataPositive.csv";
+
+ logMemory();
+ FileUtils.readLines(new File(path));
+ logMemory();
+ }
+
+ @Test
+ public final void whenStreamingThroughAFile_thenCorrect() throws IOException {
+ final String path = "G:\\full\\train\\input\\" + "trainDataNegative.csv";
+ // final String path = "G:\\full\\train\\input\\" + "trainDataPositive.csv";
+
+ logMemory();
+
+ FileInputStream inputStream = null;
+ Scanner sc = null;
+ try {
+ inputStream = new FileInputStream(path);
+ sc = new Scanner(inputStream, "UTF-8");
+ while (sc.hasNextLine()) {
+ final String line = sc.nextLine();
+ // System.out.println(line);
+ }
+ // note that Scanner suppresses exceptions
+ if (sc.ioException() != null) {
+ throw sc.ioException();
+ }
+ } finally {
+ if (inputStream != null) {
+ inputStream.close();
+ }
+ if (sc != null) {
+ sc.close();
+ }
+ }
+
+ logMemory();
+ }
+
+ //
+
+ private final void logMemory() {
+ logger.info("Max Memory: {} Mb", Runtime.getRuntime().maxMemory() / 1048576);
+ logger.info("Total Memory: {} Mb", Runtime.getRuntime().totalMemory() / 1048576);
+ logger.info("Free Memory: {} Mb", Runtime.getRuntime().freeMemory() / 1048576);
}
}
+//
\ No newline at end of file
diff --git a/httpclient/README.md b/httpclient/README.md
index 9076302992..70e44b56cf 100644
--- a/httpclient/README.md
+++ b/httpclient/README.md
@@ -4,4 +4,10 @@
### Relevant Articles:
+
+- [HttpClient 4 – Send Custom Cookie](http://www.baeldung.com/httpclient-4-cookies)
+- [HttpClient 4 – Get the Status Code](http://www.baeldung.com/httpclient-status-code)
+- [HttpClient 4 – Cancel / Abort Request](http://www.baeldung.com/httpclient-cancel-request)
- [HttpClient 4 Cookbook](http://www.baeldung.com/httpclient4)
+- [Unshorten URLs with HttpClient](http://www.baeldung.com/unshorten-url-httpclient)
+- [HttpClient with SSL](http://www.baeldung.com/httpclient-ssl)