Examples of TIntList


Examples of gnu.trove.list.TIntList

        int ints[] = new int[element_count];
        for ( int i = 0; i < element_count; i++ ) {
            ints[i] = i;
        }

        TIntList list = new TIntArrayList( 20 );
        for ( int i = 0; i < element_count; i++ ) {
            list.add( i );
        }

        assertEquals( element_count, list.size() );

        assertTrue( list.removeAll( ints ) );
        assertEquals( 0, list.size() );
        assertTrue( list.isEmpty() );

        // Reset the list
        list = new TIntArrayList( 20 );
        for ( int i = 0; i < element_count; i++ ) {
            list.add( i );
        }

        ints = new int[( element_count - 4 )] ;
        for ( int i = 0, j = 0; i < ints.length; i++, j++ ) {
            if ( i % 4 == 0 ) {
                j++;
            }
            ints[i] = j;
        }

        assertTrue( list.removeAll( ints ) );
        int expected = 4;
        assertEquals( expected, list.size() );
        for ( int i = 0; i < list.size(); i++ ) {
            expected = i * 5;
            assertEquals( "expected: " + expected + ", was: " + list.get( i ) + ", list: " + list,
                expected , list.get( i ) );
        }
    }
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.