-
May 29th, 2005, 09:29 PM
#1
collection interfaces vs. collection abstract classes
Hi Gurus,
I'm studying java 1.4 collection classes. Just notice some confusing interfaces and abstract classes.
java.util contains such interfaces as:
Code:
Collection
List
Map
Set
Also, it has some abstract classes. I've thought they're equivalents
Code:
AbstractCollection
AbstractList
AbstractMap
AbstractSet
I think interface is enough for us to create some collection-use classes. Why we need AbstrtactXXX? Am I wrong?
For example,
Code:
class myCol implements Collection {
...
}
Code:
class myCol extends AbstractCollection{
...
}
Are they the same?
-
May 29th, 2005, 10:17 PM
#2
Re: collection interfaces vs. collection abstract classes
They're convience class's. FOr example, the first paragraph in AbstractCollection javadoc is:
This class provides a skeletal implementation of the Collection interface, to minimize the effort required to implement this interface.
.
Hungarian notation, reinterpreted? http://www.joelonsoftware.com/articles/Wrong.html
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|