Examples of binarySearch()


Examples of gnu.trove.list.TIntList.binarySearch()

    assertEquals( -1, list.binarySearch( 1 ) );
    assertEquals( -1, list.binarySearch( 2 ) );
    assertEquals( -1, list.binarySearch( 3 ) );
    assertEquals( -1, list.binarySearch( 4 ) );

    assertEquals( 0, list.binarySearch( 5 ) );

    assertEquals( -2, list.binarySearch( 6 ) );
  }

View Full Code Here

Examples of gnu.trove.list.TIntList.binarySearch()

    assertEquals( -1, list.binarySearch( 3 ) );
    assertEquals( -1, list.binarySearch( 4 ) );

    assertEquals( 0, list.binarySearch( 5 ) );

    assertEquals( -2, list.binarySearch( 6 ) );
  }


  public void testSum() {
    TIntList list = new TIntLinkedList();
View Full Code Here

Examples of gnu.trove.list.TIntList.binarySearch()

            a.add( i );
        }

        a.sort();

        int index = a.binarySearch( 5 );
        assertEquals( 4, index );

        index = a.binarySearch( 8 );
        assertEquals( 7, index );
View Full Code Here

Examples of gnu.trove.list.TIntList.binarySearch()

        a.sort();

        int index = a.binarySearch( 5 );
        assertEquals( 4, index );

        index = a.binarySearch( 8 );
        assertEquals( 7, index );

        // Add more elements, but duplicates
        for ( int i = 1; i <= element_count; i++ ) {
            a.add( i );
View Full Code Here

Examples of gnu.trove.list.TIntList.binarySearch()

        index = a.indexOf( 5 );
        assertTrue( "index: " + index, index >= 8 && index <= 9 );

        // Not in this range.
        index = a.binarySearch( 5, 15, 30 );
        assertTrue( "index: " + index, index < 0 );

        try {
            a.binarySearch( 5, 10, 55 );
            fail( "Expected ArrayIndexOutOfBoundsException" );
View Full Code Here

Examples of gnu.trove.list.TIntList.binarySearch()

        // Not in this range.
        index = a.binarySearch( 5, 15, 30 );
        assertTrue( "index: " + index, index < 0 );

        try {
            a.binarySearch( 5, 10, 55 );
            fail( "Expected ArrayIndexOutOfBoundsException" );
        }
        catch ( IndexOutOfBoundsException ex ) {
            // Expected
        }
View Full Code Here

Examples of gnu.trove.list.TIntList.binarySearch()

        catch ( IndexOutOfBoundsException ex ) {
            // Expected
        }

        try {
            a.binarySearch( 5, -1, 15 );
            fail( "Expected ArrayIndexOutOfBoundsException" );
        }
        catch ( IndexOutOfBoundsException ex ) {
            // Expected
        }
View Full Code Here

Examples of gnu.trove.list.TIntList.binarySearch()

            a.add( i );
        }

        a.sort();

        int index = a.binarySearch( 5 );
        assertEquals( 4, index );

        index = a.binarySearch( 8 );
        assertEquals( 7, index );
View Full Code Here

Examples of gnu.trove.list.TIntList.binarySearch()

        a.sort();

        int index = a.binarySearch( 5 );
        assertEquals( 4, index );

        index = a.binarySearch( 8 );
        assertEquals( 7, index );

        // Add more elements, but duplicates
        for ( int i = 1; i <= element_count; i++ ) {
            a.add( i );
View Full Code Here

Examples of gnu.trove.list.TIntList.binarySearch()

        index = a.indexOf( 5 );
        assertTrue( "index: " + index, index >= 8 && index <= 9 );

        // Not in this range.
        index = a.binarySearch( 5, 15, 30 );
        assertTrue( "index: " + index, index < 0 );

        try {
            a.binarySearch( 5, 10, 55 );
            fail( "Expected ArrayIndexOutOfBoundsException" );
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.