@Test public void comparison() { assertThat(asWordSequence(dictionary, "one"), lessThan(asWordSequence(dictionary, "two"))); assertThat(asWordSequence(dictionary, "one"), lessThan(asWordSequence(dictionary, "one", "two"))); assertThat(asWordSequence(dictionary, "one", "two"), lessThanOrEqualTo(asWordSequence(dictionary, "one", "two"))); assertThat(asWordSequence(dictionary, "one", "two", "one"), greaterThan(asWordSequence(dictionary, "one", "two"))); assertThat(asWordSequence(dictionary, "one", "two", "one"), greaterThan(asWordSequence(dictionary, "one", "one", "one"))); }
public static WordSequence asWordSequence(final Dictionary dictionary, String... words) { Word[] dictWords = new Word[words.length]; for (int i = 0; i < words.length; i++) { dictWords[i] = dictionary.getWord(words[i]); } return new WordSequence(dictWords); }
WordSequence implements Comparable<WordSequence> { public static WordSequence asWordSequence(final Dictionary dictionary, String... words) { Word[] dictWords = new Word[words.length]; for (int i = 0; i < words.length; i++) { dictWords[i] = dictionary.getWord(words[i]); } return new WordSequence(dictWords); } }
WordSequence implements Comparable<WordSequence> { public static WordSequence asWordSequence(final Dictionary dictionary, String... words) { Word[] dictWords = new Word[words.length]; for (int i = 0; i < words.length; i++) { dictWords[i] = dictionary.getWord(words[i]); } return new WordSequence(dictWords); } private  WordSequence(int size);  WordSequence(Word... words);  WordSequence(List<Word> list); }
WordSequence implements Comparable<WordSequence> { public static WordSequence asWordSequence(final Dictionary dictionary, String... words) { Word[] dictWords = new Word[words.length]; for (int i = 0; i < words.length; i++) { dictWords[i] = dictionary.getWord(words[i]); } return new WordSequence(dictWords); } 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 static WordSequence asWordSequence(final Dictionary dictionary, String... words) { Word[] dictWords = new Word[words.length]; for (int i = 0; i < words.length; i++) { dictWords[i] = dictionary.getWord(words[i]); } return new WordSequence(dictWords); } 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; }