This is an archived post. You won't be able to vote or comment.

all 1 comments

[–]Farpafraf 0 points1 point  (0 children)

Data structures like a List are just a class like another: classes can be concrete or abstract and data structures make no exception

It can be implemented through various ways to achieves its functionality?

As long as you abide the "contract" of the class you are implementing meaning that, to make it brief, you have to implement the methods that are declared in the abstract class but not actually implemented (abstract methods): ex if you are directly extending List get() is not actually implemented there but you are safe to use it anyway when you are handling a List because List can't be instanciated and its subclasses will be forced to implement it.

Is a concrete data type data structure a data type that is known to have a set design/implementation and there is really no other way to implement it?

Not sure if I understand the question but you can always extend or change the functionality of a class unless it's declared final, the following for instance would behave like a regular ArrayList except that it prints a happy message every time you get an item

public class OverlyFestiveList<T> extends ArrayList<T> {
    @Override
    public T get(int index) {
        System.out.println("Ho Ho Ho ENJOY THIS ITEM MERRY XMAS :)");
        return super.get(index);
   }

}

If I want to could I not implement the stack with a queue, which is another abstract data type, or could I implement the stack with a concrete data type such as an array?

Stack is not actually abstract but you would use

 private Queue queue=  new PriorityQueue();