package kldtz.github.com.hmmt.container;

import java.util.ArrayList;
import java.util.List;

public class Sentence {
	private List<String> words;
	private List<String> tags;
	
	public Sentence() {
		words = new ArrayList<>();
		tags = new ArrayList<>();
	}
	
	public Sentence(List<String> words, List<String> tags) {
		this.words = words;
		this.tags = tags;
	}

	public List<String> words() {
		return words;
	}

	public List<String> tags() {
		return tags;
	}
	
	public void addWordTagPair(String word, String tag) {
		words.add(word);
		tags.add(tag);
	}
	
	public boolean isEmpty() {
		return words.isEmpty();
	}
}

@@ -84,36 +84,138 @@
 til.
-List;%0A%0Apublic class Sentence
+Iterator;%0Aimport java.util.List;%0Aimport java.util.NoSuchElementException;%0A%0Apublic class Sentence implements Iterable%3CWordTagTuple%3E
  %7B%0A%09
@@ -712,11 +712,628 @@
 ty();%0A%09%7D
+%0A%0A%09@Override%0A%09public Iterator%3CWordTagTuple%3E iterator() %7B%0A%09%09return new SentenceIterator();%0A%09%7D%0A%09%0A%09private class SentenceIterator implements Iterator%3CWordTagTuple%3E %7B%0A%09%09int currentIndex;%0A%09%09%0A%09%09public SentenceIterator() %7B%0A%09%09%09currentIndex = 0;%0A%09%09%7D%0A%0A%09%09@Override%0A%09%09public boolean hasNext() %7B%0A%09%09%09return currentIndex %3C words.size();%0A%09%09%7D%0A%0A%09%09@Override%0A%09%09public WordTagTuple next() %7B%0A%09%09%09if (!hasNext()) %7B%0A%09%09%09%09throw new NoSuchElementException(getClass().getName() + %22 has no further element%22);%0A%09%09%09%7D%0A%09%09%09WordTagTuple tuple = new WordTagTuple(words.get(currentIndex), tags.get(currentIndex));%0A%09%09%09currentIndex++;%0A%09%09%09return tuple;%0A%09%09%7D%0A%09%7D
 %0A%7D%0A

Make sentence iterable