Threads in Java: Processes, Runnable and Thread
A thread is an independent path of execution inside one process, and Java gives you several ways to start one.
Material for readers past the basics.
145 notes tagged
A thread is an independent path of execution inside one process, and Java gives you several ways to start one.
Every unbuffered read is a system call. Buffering turns thousands of them into a handful, and it is the single largest I/O win available.
InputStream and OutputStream carry raw bytes; Reader and Writer carry characters. Choosing wrongly corrupts data.
Path names a location and Files performs the operations. Together they replaced the older File class for almost every purpose.
DateTimeFormatter converts between text and date time values, and ZoneId handles the region rules that make time zones difficult.
Instant marks a point on the timeline; Duration measures time based amounts and Period measures date based ones.
The modern date and time API is immutable, thread safe and clearly named, and it replaced the older Date and Calendar classes entirely.
A terminal operation runs the pipeline and produces a result, and reduce is the general purpose way to fold a stream into one value.
filter, map, flatMap, sorted, distinct, limit, skip and peek. Each returns a new stream and none of them runs on its own.
A stream describes a computation over a sequence of elements. You state what you want, and the pipeline decides how to walk the data.
Optional makes absence part of the type, so a caller cannot forget that a value might not be there.
When a lambda does nothing but call an existing method, a method reference says the same thing with less noise.