A friendly place for programming greenhorns!
Big Moose Saloon
Search
|
Java FAQ
|
Recent Topics
Register / Login
Win a copy of
Arduino in Action
this week in the
General Computing
forum!
A special promo:
Enter your blog post or vote on a blogger to be featured in an upcoming Journal
JavaRanch
»
Java Forums
»
Java
»
Java in General
Author
can i add any type of collection to Collection<Instrument>
Samanthi perera
Ranch Hand
Joined: Jan 08, 2010
Posts: 510
posted
May 27, 2010 09:29:32
0
i have a collection named
Collection<Instrument> x;
can i add any type of collection x?
any type mean List,Set ,Queue or Map?
Nicola Garofalo
Ranch Hand
Joined: Apr 10, 2010
Posts: 308
posted
May 27, 2010 09:45:19
0
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...)
Bye,
Nicola
David Newton
Author
Rancher
Joined: Sep 29, 2008
Posts: 12617
I like...
posted
May 27, 2010 12:37:58
0
What happened when you tried? What did you discover in the API documentation?
I agree. Here's the link:
http://ej-technologies/jprofiler
- if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
subject: can i add any type of collection to Collection<Instrument>
Similar Threads
Generics
Generics Prob
Generics-compiler error
Generics for Interface
Regarding Generics !
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter