A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
Java in General
can i add any type of collection to Collection<Instrument>
Joined: Jan 08, 2010
May 27, 2010 09:29:32
i have a collection named
can i add any type of collection x?
any type mean List,Set ,Queue or Map?
Joined: Apr 10, 2010
May 27, 2010 09:45:19
Be careful: Map is not a subinterface of Collection
You can build an instance of all the classes implementing subinterfaces of Collection (Set,List,Queue...)
Joined: Sep 29, 2008
May 27, 2010 12:37:58
What happened when you tried? What did you discover in the API documentation?
With a little knowledge, a
cast iron skillet
is non-stick and lasts a lifetime.
subject: can i add any type of collection to Collection<Instrument>
Regarding Generics !
Generics for Interface
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2014