Real life generic class examples
design-patterns, generics, java, oop, singleton
Solution
I want to open a pet shop, I don't care what different type of pets they are but dammit I want a pet shop. I want kittens, tortoises and spiders. I want to be able to count them up, find how many animals I've got and order them as such. I don't want to have to cast the fact my tortoise is a tortoise, I know it's a tortoise.
There is only one shop bank account, I will never have more than one, where ever someone orders from me, either online or by post, there is only ever one shop bank account. There can never be another no matter where my shop is accessed from.
Problem
I got next question at Java interview: Could you name some generic class examples from real life? Not from real PROGRAMMING life, but in common. E.g. you are explaining generics to person, who doesn't know anything about programming. Same thing about the most easy design pattern - singleton. I have know any idea, about first question (about generics), I tried to name different hand tools (like fretsaw), which work with only one type of material, but it is not generics really. Please, avoid collection-like suggestions, it is too naive and obvious.