Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package container;
- import container.IContainerElement;
- public class ContainerElement<E> implements IContainerElement<E> {
- //an object of type E
- E data;
- IContainerElement<E> next;
- //constructors
- ContainerElement(E data){
- this.data=data;
- }
- ContainerElement(E data, IContainerElement<E> next){
- this.data=data;
- //nez sta da radim sa ovim sljedecim elementom
- this.next=next;
- }
- public E getData(){
- return data;
- }
- public IContainerElement<E> getNextElement(){
- return next;
- }
- public boolean hasNextElement() {
- if(next==null) return false;
- return true;
- }
- public void setNextElement (IContainerElement<E> next){
- this.next=next;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment