Skip to content
Primary Menu
  • Home
  • About

SAUSECODE

I hear and I forget. I see and I remember. I do and I understand ~ Confucius ~

Tag: PECS

Upper / Lower Bound Generics in Java!

Posted on February 23, 2025July 13, 2026

The “Invariance” Problem Imagine you have a family hierarchy: Number is the parent, and Integer and Double are its children. Naturally, because of polymorphism, you can do this: But what happens when we put them in a list? This fails because Java generics are invariant. Java does this to protect you. If it allowed the […]

Continue Reading
SAUSECODE x 2026 (c) x Chandima Samarasinghe