In: Computer Science
We see that data structures, collections, and abstract data
types are closely related concepts.
Objects that are contained within these entities are typically
called items or elements.
From the object-oriented perspective, data structures have both
private data and public behaviors.
The behaviors define data structures in an abstract, implementation
independent manner.
Other equivalent terms used for behaviors are operations, methods,
public interface, and usage interface. In this discussion, we
explore the primary behaviors needed to use data structures.
- Remove an item
- Replace an item
Discuss these behaviors.
The data structures are used to store the data in an organized and efficient way.
Collection is a generic term for a group of objects. Collection interface in java provides methods to manipulate
and store efficiently the group of objects.
Abstract data types are the data types for which only the operations are provided, not the implementation.
Example: ArrayList, LinkedList, Stack, Queue and more.
The primary behaviors needed to use the data structures are :
-Remove an item: All the Abstract data types are provided with predefined methods to remove any item from the data structures.
For example ArrayList has a method remove() which when called removes the particular element from it.
-Replace an item: The abstract data types have predefined methods to set the value in the data structures at the index where a value is already there.
For example ArrayList has a method set() which takes two arguments i.e. index and the element. It sets the value in the ArrayList at a given index. If another value is present earlier then this method replaces the old value with the new one.