What is Data Structure?
first of all lets break it down to pieces : Data and Structure.
What is a data? Googling on the internet said :
Philosophy “things that is probably known or assumed as facts, making the basis of reasoning or calculation”.
Computing “the quantities, characters, or symbols on which operations are performed by a computer, being stored and transmitted in the form of another electrical signals and recorded on magnetic, optical, or mechanical recording media“
Continue reading Data Structure Definition Java
As you see from the last post, choices have methods such as the add() method, well if you don’t know… methods such as add() comes from a Framework in Java called Collections. Collections is a Framework (as I said) that provides the user an architecture that is used to store and manipulate a group of objects.
Not only add() method that you can do, you can do much more like : searching, insertion, sorting, deletion, manipulation etc… in Java Collections.
Here’s a list of what Collections provides :
- Treeset, etc…
What is a Framework in java?
Framework provides a readymade architecture that represents a set of classes and interface and it’s optional.
Here’s a list of methods that Collection provides :
- public boolean add(Object element) : this is used to insert an element in this collection.
- public boolean remove(Object element) : the method s used to delete an element from this collection.
- public boolean removeAll(Collection c) : this one is used to delete all the elements of specified collection from the invoking collection.
- public int size() : will return the total number of elements in the collection.
- public boolean contains(Object element) : all it used is to search an element.
- public Iterator iterator() : this’ll returns an iterator.
- public Object toArray() : will converts collection into array.
- public boolean equals(Object element) : will matches two collection.
well since I didn’t put all of it, I’m gonna say … ETC.
An Iterator interface will provides a facility for iterating the elements in forward direction only.
Here’s a list of methods in Iterator interface :
- public boolean hasNext() : it will returns true boolean if iterator has more elements.
- public object next() : it returns the element and moves the cursor pointer to the next element.
- public void remove() : it removes the last elements returned by the iterator. It is rarely used.
- Collections is a Framework (as I said) that provides the user an architecture that is used to store and manipulate a group of objects.
- Framework provides a readymade architecture that represents a set of classes and interface and it’s optional.
- An Iterator interface will provides a facility for iterating the elements in forward direction only.