Package gnu.trove.iterator

Examples of gnu.trove.iterator.TIntLongIterator



    public void testIterator() {
        TIntLongMap map = new TIntLongHashMap();

        TIntLongIterator iterator = map.iterator();
        assertFalse( iterator.hasNext() );

        map.put( KEY_ONE, 1 );
        map.put( KEY_TWO, 2 );

        iterator = map.iterator();
        assertTrue( iterator.hasNext() );
        iterator.advance();
    boolean found_one;
    if ( iterator.value() == 1 ) {
      assertEquals( KEY_ONE, iterator.key() );
      found_one = true;
    }
    else {
      assertEquals( 2, iterator.value() );
      assertEquals( KEY_TWO, iterator.key() );
      found_one = false;
    }


        assertTrue( iterator.hasNext() );
        iterator.advance();
    if ( found_one ) {
      assertEquals( 2, iterator.value() );
      assertEquals( KEY_TWO, iterator.key() );
    }
    else {
      assertEquals( 1, iterator.value() );
      assertEquals( KEY_ONE, iterator.key() );
    }

        assertFalse( iterator.hasNext() );

        int key = iterator.key();
        long old_value = iterator.value();

    if ( found_one ) {
      assertEquals( 2, old_value );
      assertEquals( KEY_TWO, iterator.key() );
    }
    else {
      assertEquals( 1, old_value );
      assertEquals( KEY_ONE, iterator.key() );
    }

        assertEquals( old_value, iterator.setValue( old_value * 10 ) );
        assertEquals( old_value * 10, iterator.value() );

        assertFalse( map.containsValue( old_value ) );
        assertTrue( map.containsValue( old_value * 10 ) );
        assertEquals( old_value * 10, map.get( key ) );

        iterator.remove();
        assertFalse( map.containsValue( old_value * 10 ) );
        assertEquals( map.getNoEntryValue(), map.get( key ) );
        assertEquals( 1, map.size() );
    }
View Full Code Here


   */
  public boolean canTell(int charId, String text)
  {
    long currentMillis = System.currentTimeMillis();
    long lastSent;
    TIntLongIterator itr = _recentReceivers.iterator();
    int recent = 0;
    while (itr.hasNext())
    {
      itr.advance();
      lastSent = itr.value();
      if ((currentMillis - lastSent) < (text.equalsIgnoreCase(_lastText) ? 600000L : 60000L))
      {
        recent++;
      }
      else
      {
        itr.remove();
      }
    }
    lastSent = _recentReceivers.put(charId, currentMillis);
    long delay = 333L;
    if (recent > 3)
View Full Code Here

TOP

Related Classes of gnu.trove.iterator.TIntLongIterator

Copyright © 2018 www.massapicom. 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.