Examples of IntListHashMap


Examples of de.jarnbjo.jsnappy.IntListHashMap

public class IntListHashMapTest {

  @Test
  public void testSimple1() {
    IntListHashMap m = new IntListHashMap(10);
    m.put(5, 1);
    m.put(5, 2);
    m.put(5, 3);
    IntIterator i = m.getReverse(5);
    assertNotNull(i);

    assertTrue(i.next());
    assertEquals(3, i.get());
View Full Code Here

Examples of de.jarnbjo.jsnappy.IntListHashMap

    assertEquals(1, i.get());
  }

  @Test
  public void testCollision() {
    IntListHashMap m = new IntListHashMap(10);
    m.put(5, 1);
    m.put(5, 2);
    m.put(5, 3);
    m.put(15, 4);
    m.put(15, 5);
    m.put(15, 6);

    IntIterator i = m.getReverse(5);
    assertNotNull(i);

    assertTrue(i.next());
    assertEquals(3, i.get());

    assertTrue(i.next());
    assertEquals(2, i.get());

    assertTrue(i.next());
    assertEquals(1, i.get());

    assertFalse(i.next());

    i = m.getReverse(15);
    assertNotNull(i);

    assertTrue(i.next());
    assertEquals(6, i.get());
View Full Code Here

Examples of de.jarnbjo.jsnappy.IntListHashMap

  }

  @Test
  public void testExpand() {

    IntListHashMap m = new IntListHashMap(10);
    for(int i=1; i<=1000; i++) {
      m.put(1, i);
    }

    IntIterator ii = m.getReverse(1);
    assertNotNull(ii);

    for(int i=1000; i>=1; i--) {
      assertTrue(ii.next());
      assertEquals(i, ii.get());
View Full Code Here

Examples of de.jarnbjo.jsnappy.IntListHashMap

  }
 
  @Test
  public void testRemoveDuplicates() {

    IntListHashMap m = new IntListHashMap(10);
    m.put(1, 1);
    m.put(1, 1);

    IntIterator ii = m.getReverse(1);
    assertNotNull(ii);

    assertTrue(ii.next());
    assertEquals(1, ii.get());
    assertFalse(ii.next());
View Full Code Here

Examples of de.jarnbjo.jsnappy.IntListHashMap

    assertFalse(ii.next());
  }

  @Test
  public void testFirstHit1() {   
    IntListHashMap m = new IntListHashMap(10);
    m.put(1, 1);
    m.put(1, 2);   
    assertEquals(2, m.getFirstHit(1, Integer.MAX_VALUE));   
  }
View Full Code Here

Examples of de.jarnbjo.jsnappy.IntListHashMap

    assertEquals(2, m.getFirstHit(1, Integer.MAX_VALUE));   
  }
 
  @Test
  public void testFirstHit2() {   
    IntListHashMap m = new IntListHashMap(10);
    m.put(1, 1);
    m.put(1, 2);   
    m.put(11, 3);   
    assertEquals(2, m.getFirstHit(1, Integer.MAX_VALUE));   
  }
View Full Code Here

Examples of de.jarnbjo.jsnappy.IntListHashMap

    m.put(11, 3);   
    assertEquals(2, m.getFirstHit(1, Integer.MAX_VALUE));   
  }
 
  public void testNoHit() {
    IntListHashMap m = new IntListHashMap(2);
    m.put(0, 1);
    m.put(1, 1);   
    assertEquals(-1, m.getFirstHit(2, Integer.MAX_VALUE));       
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.