A generic type connects operations that must agree on a value's type. Box stores and returns String without a cast. A bounded type parameter exposes the operations a helper needs, such as compareTo through Comparable. Bounds are contracts the compiler can enforce, not permission to assume every T is an Integer.
Java generics are invariant: List isn't a List. A reader can accept List<? extends Number> because it only needs Number operations. A writer can accept List<? super Integer> because adding an Integer is safe for an Integer, Number or Object consumer. Reading from that consumer yields only Object. The workspace entry point uses ordinary array types; generic helpers inside Solution demonstrate the reusable API. You will preserve duplicate values and handle empty or negative data without unsafe type assumptions.