-
Java How to Split String by New Line
In Java, we can use regex \\r?\\n to split a String by new line.
Date: 2019-08-11 View: 1520
-
Java How to print a Pyramid
A Java example to print half and full pyramid, for fun.
Date: 2019-08-11 View: 1520
-
Java Count the number of items in a List
In Java, we can use List.size() to count the number of items in a List
Date: 2019-08-11 View: 1520
-
Java How to convert System.nanoTime to Seconds
We can just divide the nanoTime by 1_000_000_000, or use the TimeUnit.SECONDS.convert to convert it.
Date: 2019-08-11 View: 1520
-
Java How to join List String with commas
In Java, we can use String.join(",", list) to join a List String with commas.
Date: 2019-08-11 View: 1520
-
Java Find the length of BigInteger?
In Java, we can convert the BigInteger to a String object and get the length of the String.
Date: 2019-08-11 View: 1520
-
Java Global variable examples
In Java, there is no global keyword, but we can use public static variable to referring a global variable.
Date: 2019-08-11 View: 1520
-
Java JMH Benchmark Tutorial
In Java, we can use JMH (Java Microbenchmark Harness) framework to measure the performance of a function.
Date: 2019-08-11 View: 1520
-
Java 8 Stream.iterate examples
In Java 8, we can use Stream.iterate to create stream values on demand, so called infinite stream.
Date: 2019-08-11 View: 1520
-
Java Fibonacci examples
Fibonacci number – Every number after the first two is the sum of the two preceding.
Date: 2019-08-11 View: 1520
-
Java Fork/Join Framework examples
The fork/join framework is available since Java 7, to make it easier to write parallel programs. We can implement the fork/join framework by extending either RecursiveTask or RecursiveAction
Date: 2019-08-11 View: 1520
-
Java ScheduledExecutorService examples
In Java, we can use ScheduledExecutorService to run a task periodically or once time after a predefined delay by TimeUnit.
Date: 2019-08-11 View: 1520
-
Java ExecutorService examples
In Java, we can use ExecutorService to create a thread pool, and tracks the progress of the asynchronous tasks with Future.
Date: 2019-08-11 View: 1520
-
Java Sequence Generator examples
An example to show you how to create a thread safe sequence generator.
Date: 2019-08-11 View: 1520
-
Java Semaphore examples
In Java, we can use Semaphore to limit the number of threads to access a certain resource.
Date: 2019-08-11 View: 1520