Java 8: Remedies for What cannot be done in Generics
Generic programming the way to reuse code for Objects of many different types. The unbounded wild card is "?" (which is actually "? extends Object"). You can read from it, but you cannot write. If your type variable is T then you can use only extends (never super ) with T then, the upper-bounded wildcard is "? extends T". you can define read from but can not add (only super support with wildcards) The term covariant preserves the ordering of types from more specific to more general. Collections are covariant when they use extends wildcard. The lower-bounded wildcard is "? super T". Collections are contravariant when they use super with a wildcard. The term contravariant preserves the ordering of types from more general to more specific. Here supplied element must be itself or above of the T . The rule of thumb is "producer => extends and consumer => super": PECS.  As shown in the above, you can copy the eleme...