@Test public void getOldest() { WordSequence ws = asWordSequence(dictionary, "zero", "six", "one"); assertThat(asWordSequence(dictionary, "zero", "six"), equalTo(ws.getOldest())); assertThat(ws.getOldest().getOldest(), equalTo(new WordSequence(ws.getWord(0)))); }
public WordSequence getOldest() { WordSequence next = EMPTY; if (size() >= 1) { next = new WordSequence(words.length - 1); System.arraycopy(this.words, 0, next.words, 0, next.words.length); } return next; }
WordSequence implements Comparable<WordSequence> { public WordSequence getOldest() { WordSequence next = EMPTY; if (size() >= 1) { next = new WordSequence(words.length - 1); System.arraycopy(this.words, 0, next.words, 0, next.words.length); } return next; } }
WordSequence implements Comparable<WordSequence> { public WordSequence getOldest() { WordSequence next = EMPTY; if (size() >= 1) { next = new WordSequence(words.length - 1); System.arraycopy(this.words, 0, next.words, 0, next.words.length); } return next; } private  WordSequence(int size);  WordSequence(Word... words);  WordSequence(List<Word> list); }
WordSequence implements Comparable<WordSequence> { public WordSequence getOldest() { WordSequence next = EMPTY; if (size() >= 1) { next = new WordSequence(words.length - 1); System.arraycopy(this.words, 0, next.words, 0, next.words.length); } return next; } private  WordSequence(int size);  WordSequence(Word... words);  WordSequence(List<Word> list); static WordSequence asWordSequence(final Dictionary dictionary,
            String... words); WordSequence addWord(Word word, int maxSize); WordSequence getOldest(); WordSequence getNewest(); WordSequence trim(int maxSize); Word getWord(int n); int size(); @Override String toString(); @Override int hashCode(); @Override boolean equals(Object object); WordSequence getSubSequence(int startIndex, int stopIndex); Word[] getWords(); int compareTo(WordSequence other); }
WordSequence implements Comparable<WordSequence> { public WordSequence getOldest() { WordSequence next = EMPTY; if (size() >= 1) { next = new WordSequence(words.length - 1); System.arraycopy(this.words, 0, next.words, 0, next.words.length); } return next; } private  WordSequence(int size);  WordSequence(Word... words);  WordSequence(List<Word> list); static WordSequence asWordSequence(final Dictionary dictionary,
            String... words); WordSequence addWord(Word word, int maxSize); WordSequence getOldest(); WordSequence getNewest(); WordSequence trim(int maxSize); Word getWord(int n); int size(); @Override String toString(); @Override int hashCode(); @Override boolean equals(Object object); WordSequence getSubSequence(int startIndex, int stopIndex); Word[] getWords(); int compareTo(WordSequence other); final static Comparator<WordSequence> OLDEST_COMPARATOR; final static WordSequence EMPTY; }