Example usage for org.apache.commons.collections4 Trie size

List of usage examples for org.apache.commons.collections4 Trie size

Introduction

In this page you can find the example usage for org.apache.commons.collections4 Trie size.

Prototype

int size();

Source Link

Document

Returns the number of key-value mappings in this map.

Usage

From source file:cherry.foundation.telno.AreaCodeTableFactoryTest.java

@Test
public void test() throws Exception {

    List<Resource> resources = new ArrayList<>(9);
    resources.add(new ClassPathResource("cherry/goods/telno/soumu/000124070.xls"));
    resources.add(new ClassPathResource("cherry/goods/telno/soumu/000124071.xls"));
    resources.add(new ClassPathResource("cherry/goods/telno/soumu/000124072.xls"));
    resources.add(new ClassPathResource("cherry/goods/telno/soumu/000124073.xls"));
    resources.add(new ClassPathResource("cherry/goods/telno/soumu/000124074.xls"));
    resources.add(new ClassPathResource("cherry/goods/telno/soumu/000124075.xls"));
    resources.add(new ClassPathResource("cherry/goods/telno/soumu/000124076.xls"));
    resources.add(new ClassPathResource("cherry/goods/telno/soumu/000124077.xls"));
    resources.add(new ClassPathResource("cherry/goods/telno/soumu/000124078.xls"));
    AreaCodeTableFactory factory = new AreaCodeTableFactory();
    factory.setSoumuExcelParser(new SoumuExcelParser());
    factory.setResources(resources);/*from ww  w .  ja  v a2 s.  c  om*/

    Trie<String, Integer> trie = factory.getObject();
    SortedMap<String, Integer> map = trie.prefixMap("042");
    assertEquals(790, map.size());
    assertEquals(new TreeSet<Integer>(asList(2, 3, 4)), new TreeSet<>(map.values()));

    assertEquals(4554 + 5683 + 3400 + 5343 + 5307 + 3000 + 5548 + 4526 + 5330, trie.size());
    assertEquals(Trie.class, factory.getObjectType());
    assertFalse(factory.isSingleton());
}