hello...i am confused,,it is possible that a linkedstack will be full??i only implement a method that isEmpty(),,and it reads the method if the stack is empty..but if the stack is full, it do not even read the method i made....would someone help me?/,,,thank you ahead...

Recommended Answers

All 3 Replies

hello...i am confused,,it is possible that a linkedstack will be full??i only implement a method that isEmpty(),,and it reads the method if the stack is empty..but if the stack is full, it do not even read the method i made....would someone help me?/,,,thank you ahead...

If you know what a "linked" list is, and I suppose you ought to know that if you are implementing a stack with it, what does common sense tell you ?

hello...i am confused,,it is possible that a linkedstack will be full??i only implement a method that isEmpty(),,and it reads the method if the stack is empty..but if the stack is full, it do not even read the method i made....would someone help me?/,,,thank you ahead...

The Collection classes of Java increase in capacity on demand. If the number of elements added to an ArrayList exceed its default capacity, it grows on demand automatically to make space or room for the newly added elements.

The only practical limit to the number of items that can be added to a List is the amount of physical memory allocated to the process [java process] and hence there seems to be no reason or need to implement a isFull() method for a collection class. If you need such a behavior, either subclass the AbstractSequentialList class to add an upperbound to the number of elements that can be added or just use arrays if the exact number of elements are known.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.