Java Function Interface Implementation Guide
The Functon interface in Java 8 represents an operation that accepts one argument and produces a result. This functional interface contains the abstarct method apply which defines the transformation logic.
@FunctionalInterface
public interface Transformer<T, R> {
R transform(T input);
default <V> Transformer<V, R> com ...
Posted on Sun, 09 Aug 2026 16:04:44 +0000 by khurramijaz
Understanding Iterable and Iterator in Java Collections
To enable iteration over a collection using enhanced for-loops, a class must implement the Iterable interface. This contract requires providing an Iterator instance via the iterator() method — essentially granting permission to be traversed element by element.
// Minimal Iterable interface
public interface Iterable<T> {
Iterator<T& ...
Posted on Tue, 14 Jul 2026 16:34:12 +0000 by Dragen
Java 8 Date and Time API Fundamentals
Core Date-Time Classes in Java 8
Java's traditional date and time handling prior to Java 8 presented challenges due to unintuitive design and thread safety concerns in java.util.Date and java.util.Calendar. The Java 8 Date-Time API introduced immutable, thread-safe alternatives including LocalDate, LocalTime, and LocalDateTime.
Date Handling wi ...
Posted on Sat, 13 Jun 2026 18:02:35 +0000 by ReVeR
Method References in Java 8
Method referecnes in Java 8 provide a concise syntax to refer directly to methods or constructors without executing them. They are useful when a lambda expression merely calls an existing method, allowing the code to be more readable and reusable.
Consider a Person class:
public class Person {
public enum Sex { MALE, FEMALE }
String na ...
Posted on Sun, 17 May 2026 23:41:54 +0000 by adaykin