LinkedList implements Deque which is correct since a Deque requires elements can be added and removed from / to the beginning or end and LinkedList qualifies for this by offering insertion and deletion at random positions. Note that the inheritance relation between List and the newer Deque interface is more consistent than between List and Stack. (This is not what does which brings us back to the quote from the docs.) For example, we could implement Stack by simply delegating to ArrayList but provide a type that clearly says in its name what its meant to be and does not provide operations (like random access) that might violate the concept of a stack.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |