Package gnu.trove.set

Examples of gnu.trove.set.TIntSet.addAll()


        int no_entry_value = Integer.MIN_VALUE;
        TIntSet set = new TIntHashSet( 10, 0.5f, no_entry_value );
        assertEquals( no_entry_value, set.getNoEntryValue() );

        int[] ints = {42, 1138, 13, 86, 99};
        set.addAll( ints );

        int[] sink = new int[ints.length + 2];
        sink[sink.length - 1] = -1;
        sink[sink.length - 2] = -2;
View Full Code Here



    public void testForEach() {
        TIntSet set = new TIntHashSet( 10, 0.5f );
        int[] ints = {1138, 42, 86, 99, 101};
        set.addAll( ints );

        class ForEach implements TIntProcedure {

            TIntSet built = new TIntHashSet();
View Full Code Here


    public void testEquals() {
        int[] ints = {1138, 42, 86, 99, 101};
        TIntSet set = new TIntHashSet();
        set.addAll( ints );
        TIntSet other = new TIntHashSet();
        other.addAll( ints );

        assertTrue( "sets incorrectly not equal: " + set + ", " + other,
                set.equals( other ) );
View Full Code Here

    public void testEquals() {
        int[] ints = {1138, 42, 86, 99, 101};
        TIntSet set = new TIntHashSet();
        set.addAll( ints );
        TIntSet other = new TIntHashSet();
        other.addAll( ints );

        assertTrue( "sets incorrectly not equal: " + set + ", " + other,
                set.equals( other ) );

        int[] mismatched = {72, 49, 53, 1024, 999};
View Full Code Here

        assertTrue( "sets incorrectly not equal: " + set + ", " + other,
                set.equals( other ) );

        int[] mismatched = {72, 49, 53, 1024, 999};
        TIntSet unequal = new TIntHashSet();
        unequal.addAll( mismatched );

        assertFalse( "sets incorrectly equal: " + set + ", " + unequal,
                set.equals( unequal ) );

        // Change length, different code branch
View Full Code Here


    public void testHashcode() {
        int[] ints = {1138, 42, 86, 99, 101};
        TIntSet set = new TIntHashSet();
        set.addAll( ints );
        TIntSet other = new TIntHashSet();
        other.addAll( ints );

        assertTrue( "hashcodes incorrectly not equal: " + set + ", " + other,
                set.hashCode() == other.hashCode() );
View Full Code Here

    public void testHashcode() {
        int[] ints = {1138, 42, 86, 99, 101};
        TIntSet set = new TIntHashSet();
        set.addAll( ints );
        TIntSet other = new TIntHashSet();
        other.addAll( ints );

        assertTrue( "hashcodes incorrectly not equal: " + set + ", " + other,
                set.hashCode() == other.hashCode() );

        int[] mismatched = {72, 49, 53, 1024, 999};
View Full Code Here

        assertTrue( "hashcodes incorrectly not equal: " + set + ", " + other,
                set.hashCode() == other.hashCode() );

        int[] mismatched = {72, 49, 53, 1024, 999};
        TIntSet unequal = new TIntHashSet();
        unequal.addAll( mismatched );

        assertFalse( "hashcodes unlikely equal: " + set + ", " + unequal,
                set.hashCode() == unequal.hashCode() );
    }
View Full Code Here

    public void testConstructors() throws Exception {
        TIntSet set = new TIntHashSet();
        assertNotNull( set );

        int[] ints = {1138, 42, 86, 99, 101};
        set.addAll( ints );

        TIntSet copy = new TIntHashSet( set );
        assertTrue( "set not a copy: " + set + ", " + copy, set.equals( copy ) );

        TIntSet another = new TIntHashSet( 20 );
View Full Code Here

        TIntSet copy = new TIntHashSet( set );
        assertTrue( "set not a copy: " + set + ", " + copy, set.equals( copy ) );

        TIntSet another = new TIntHashSet( 20 );
        another.addAll( ints );
        assertTrue( "set not equal: " + set + ", " + copy, set.equals( another ) );

        another = new TIntHashSet( 2, 1.0f );
        another.addAll( ints );
        assertTrue( "set not equal: " + set + ", " + copy, set.equals( another ) );
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.