### Question:
LmVocabulary { public static Builder builder() { return new Builder(); } LmVocabulary(String... vocabulary);  LmVocabulary(List<String> vocabulary); private  LmVocabulary(RandomAccessFile raf); private  LmVocabulary(DataInputStream dis); static LmVocabulary loadFromBinary(File binaryVocabularyFile); static LmVocabulary loadFromBinary(Path binaryVocabularyFilePath); static LmVocabulary loadFromRandomAccessFile(RandomAccessFile raf); static LmVocabulary loadFromDataInputStream(DataInputStream dis); static LmVocabulary loadFromUtf8File(File utfVocabularyFile); static Builder builder(); static LmVocabulary intersect(LmVocabulary v1, LmVocabulary v2); void saveBinary(File file); void saveBinary(DataOutputStream dos); int size(); boolean containsUnknown(int... gramIds); boolean containsSuffix(); boolean containsPrefix(); String getWord(int index); int indexOf(String word); int getSentenceStartIndex(); int getSentenceEndIndex(); int getUnknownWordIndex(); String getUnknownWord(); String getSentenceStart(); String getSentenceEnd(); Iterable<Integer> alphabeticallySortedWordsIds(Locale locale); Iterable<Integer> alphabeticallySortedWordsIds(); Iterable<String> words(); Iterable<String> wordsSorted(); Iterable<String> wordsSorted(Locale locale); String getWordsString(int... indexes); boolean containsAll(int... indexes); boolean contains(int index); boolean containsAll(String... words); boolean contains(String word); long encodeTrigram(int g0, int g1, int g2); long encodeTrigram(int... triGram); int[] toIndexes(String... words); int[] toIndexes(String[] history, String word); int[] toIndexes(int[] history, String word); String[] toWords(int... indexes); static final String DEFAULT_SENTENCE_BEGIN_MARKER; static final String DEFAULT_SENTENCE_END_MARKER; static final String DEFAULT_UNKNOWN_WORD; }### Answer:
@Test public void builderTest() throws IOException { LmVocabulary.Builder builder = LmVocabulary.builder(); String[] words = {"elma", "çilek", "karpuz", "armut", "elma", "armut"}; for (String word : words) { builder.add(word); } Assert.assertEquals(4, builder.size()); Assert.assertEquals(0, builder.indexOf("elma")); Assert.assertEquals(1, builder.indexOf("çilek")); Assert.assertEquals(2, builder.indexOf("karpuz")); Assert.assertEquals(-1, builder.indexOf("mango")); List<Integer> list = Lists.newArrayList(builder.alphabeticallySortedWordsIds()); Assert.assertEquals(Lists.newArrayList(3, 0, 2, 1), list); list = Lists.newArrayList(builder.alphabeticallySortedWordsIds(new Locale("tr"))); Assert.assertEquals(Lists.newArrayList(3, 1, 0, 2), list); LmVocabulary vocab = builder.generate(); Assert.assertEquals(7, vocab.size()); }