DetokenizationDictionary { public void serialize(OutputStream out) throws IOException { Iterator<Entry> entries = new Iterator<Entry>() { Iterator<String> iterator = operationTable.keySet().iterator(); public boolean hasNext() { return iterator.hasNext(); } public Entry next() { String token = iterator.next(); Attributes attributes = new Attributes(); attributes.setValue("operation", getOperation(token).toString()); return new Entry(new StringList(token), attributes); } public void remove() { throw new UnsupportedOperationException(); } }; DictionarySerializer.serialize(out, entries, false); } DetokenizationDictionary(String tokens[],
      DetokenizationDictionary.Operation operations[]);  DetokenizationDictionary(InputStream in); void serialize(OutputStream out);  }
@Test public void testSerialization() throws IOException, InvalidFormatException { ByteArrayOutputStream out = new ByteArrayOutputStream(); dict.serialize(out); DetokenizationDictionary parsedDict = new DetokenizationDictionary( new ByteArrayInputStream(out.toByteArray())); testEntries(parsedDict); }