You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

97 lines
1.9 KiB

package ru.defend.defdevteam.tstu;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.ListIterator;
import java.util.NoSuchElementException;
/**
* Created by itsmy on 13.02.2017.
*/
public class NewsItemList {
private ArrayList<Group> list;
NewsItemList() {
list = new ArrayList<>();
}
public int size() {
return list.size();
}
public Group get(int index) {
return list.get(index);
}
public void add(Group group) {
this.list.add(group);
}
public void set(int index, Group group) {
this.list.set(index, group);
}
public void clear() {
this.list.clear();
}
// @Override
// public Iterator<Group> iterator() {
// return new NewsIterator();
// }
// private class NewsIterator implements Iterator<Group> {
// private int cursor;
//
// public NewsIterator() {
// this.cursor = 0;
// }
//
// public boolean hasNext() {
// return this.cursor < size();
// }
//
// public Group next() {
// if(this.hasNext()) {
// Group current = get(cursor);
// cursor ++;
// return current;
// }
// throw new NoSuchElementException();
// }
//
// public void remove() {
// throw new UnsupportedOperationException();
// }
// }
public class Group {
private String title;
private String text;
private String link;
Group(String title, String text, String link) {
this.title = title;
this.text = text;
this.link = link;
}
public String getTitle() {
return this.title;
}
public String getText() {
return this.text;
}
public String getLink() {
return this.link;
}
}
}