-
Java 8 Stream.iterate examples
In Java 8, we can use Stream.iterate to create stream values on demand, so called infinite stream.
2019-08-11【[Java]】
阅读更多 -
Java Fibonacci examples
Fibonacci number – Every number after the first two is the sum of the two preceding.
2019-08-11【[Java]】
阅读更多 -
Java How to read a file into a list?
In Java, there are few ways to read a file line by line into a List
2019-08-11【[Java]】
阅读更多 -
Java 8 How to sort list with stream.sorted()
Few examples to show you how to sort a List with stream.sorted()
2019-08-11【[Java]】
阅读更多 -
Java How to declare and initialize an Array
Few Java examples to declare, initialize and manipulate Array in Java
2019-08-11【[Java]】
阅读更多 -
Java 8 How to convert IntStream to Integer[]
The key is boxed() the IntStream into a Stream<Integer>, then only convert to an Array.
2019-08-11【[Java]】
阅读更多 -
Java 8 Convert a Stream to Array
In Java 8, we can use .toArray() to convert a Stream into an Array.
2019-08-11【[Java]】
阅读更多 -
Java 8 Should we close the Stream after use?
Only Streams whose source are an IO channel like Files.lines(Path, Charset) need to be closed.
2019-08-11【[Java]】
阅读更多 -
Java 8 Stream The peek() is not working with count()?
Many examples are using the .count() as the terminal operation for .peek(), for example:
2019-08-11【[Java]】
阅读更多 -
Java Prime Numbers examples
The following Java examples will print a list of all the prime numbers up to 1,000:
2019-08-11【[Java]】
阅读更多 -
Java 8 Parallel Streams Examples
Few Java 8 examples to execute streams in parallel.
2019-08-11【[Java]】
阅读更多 -
How to loop an enum in Java
Call the .values() method of the enum class to return an array, and loop it with the for loop:
2019-08-11【[Java]】
阅读更多 -
Java 8 Stream Convert List<List<String>> to List<String>
As title, we can use flatMap to convert it.
2019-08-11【[Java]】
阅读更多 -
Java Regular Expression Examples
Java 8 stream and regular expression examples.
2019-08-11【[Java]】
阅读更多