Package gnu.trove.stack

Examples of gnu.trove.stack.TIntStack.push()


    public void testConstructors() {
        TIntStack stack = new TIntArrayStack();
        assertEquals( 0, stack.size() );

        stack.push( 10 );
        stack.push( 20 );
        assertEquals( 2, stack.size() );

        TIntStack other = new TIntArrayStack( 20 );
        other.push( 10 );
        other.push( 20 );
View Full Code Here


        stack.push( 10 );
        stack.push( 20 );
        assertEquals( 2, stack.size() );

        TIntStack other = new TIntArrayStack( 20 );
        other.push( 10 );
        other.push( 20 );
        assertEquals( 2, other.size() );

        assertTrue( "stacks should be equal: " + stack + ", " + other,
      stack.equals( other ) );
View Full Code Here

        stack.push( 20 );
        assertEquals( 2, stack.size() );

        TIntStack other = new TIntArrayStack( 20 );
        other.push( 10 );
        other.push( 20 );
        assertEquals( 2, other.size() );

        assertTrue( "stacks should be equal: " + stack + ", " + other,
      stack.equals( other ) );
View Full Code Here

    public void testBasic() {
        TIntStack stack = new TIntArrayStack();

        assertEquals( 0, stack.size() );

        stack.push( 10 );

        assertEquals( 1, stack.size() );

        assertEquals( 10, stack.peek() );
        assertEquals( 1, stack.size() );
View Full Code Here

        assertEquals( 1, stack.size() );

        assertEquals( 10, stack.pop() );
        assertEquals( 0, stack.size() );

        stack.push( 10 );
        stack.push( 20 );
        stack.push( 30 );

        assertEquals( 3, stack.size() );
        assertEquals( 30, stack.pop() );
View Full Code Here

        assertEquals( 10, stack.pop() );
        assertEquals( 0, stack.size() );

        stack.push( 10 );
        stack.push( 20 );
        stack.push( 30 );

        assertEquals( 3, stack.size() );
        assertEquals( 30, stack.pop() );
        assertEquals( 20, stack.pop() );
View Full Code Here

        assertEquals( 10, stack.pop() );
        assertEquals( 0, stack.size() );

        stack.push( 10 );
        stack.push( 20 );
        stack.push( 30 );

        assertEquals( 3, stack.size() );
        assertEquals( 30, stack.pop() );
        assertEquals( 20, stack.pop() );
        assertEquals( 10, stack.pop() );
View Full Code Here

        array = stack.toArray();
        assertNotNull( array );
        assertEquals( 0, array.length );

        stack.push( 10 );
        stack.push( 20 );
        stack.push( 30 );
        stack.push( 40 );

        array = stack.toArray();
View Full Code Here

        array = stack.toArray();
        assertNotNull( array );
        assertEquals( 0, array.length );

        stack.push( 10 );
        stack.push( 20 );
        stack.push( 30 );
        stack.push( 40 );

        array = stack.toArray();
        assertNotNull( array );
View Full Code Here

        assertNotNull( array );
        assertEquals( 0, array.length );

        stack.push( 10 );
        stack.push( 20 );
        stack.push( 30 );
        stack.push( 40 );

        array = stack.toArray();
        assertNotNull( array );
        assertEquals( 4, array.length );
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.