当前位置: 首页>>代码示例>>Java>>正文


Java TIntList.remove方法代码示例

本文整理汇总了Java中gnu.trove.list.TIntList.remove方法的典型用法代码示例。如果您正苦于以下问题:Java TIntList.remove方法的具体用法?Java TIntList.remove怎么用?Java TIntList.remove使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在gnu.trove.list.TIntList的用法示例。


在下文中一共展示了TIntList.remove方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testIteratorAbuseNext

import gnu.trove.list.TIntList; //导入方法依赖的package包/类
public void testIteratorAbuseNext() {
    int element_count = 20;
    TIntList list = new TIntArrayList();
    for ( int i = 0; i < element_count; i++ ) {
        list.add( i );
    }

    TIntIterator iter = list.iterator();
    while ( iter.hasNext() ) {
        iter.next();
    }
    assertFalse( iter.hasNext() );

    list.remove( 5, 10 );
    assertFalse( iter.hasNext() );
    try {
        iter.next();
        fail( "Expected NoSuchElementException" );
    } catch( NoSuchElementException ex ) {
        // Expected.
    }
}
 
开发者ID:palantir,项目名称:trove-3.0.3,代码行数:23,代码来源:TPrimitiveArrayListTest.java

示例2: testIteratorAbuseRemove

import gnu.trove.list.TIntList; //导入方法依赖的package包/类
public void testIteratorAbuseRemove() {
    int element_count = 20;
    TIntList list = new TIntArrayList();
    for ( int i = 0; i < element_count; i++ ) {
        list.add( i );
    }

    TIntIterator iter = list.iterator();
    while ( iter.hasNext() ) {
        iter.next();
    }
    assertFalse( iter.hasNext() );

    list.remove( 5, 10 );
    assertFalse( iter.hasNext() );

    try {
        iter.remove();
        fail( "Expected ConcurrentModificationException" );
    } catch( ConcurrentModificationException ex ) {
        // Expected.
    }
}
 
开发者ID:palantir,项目名称:trove-3.0.3,代码行数:24,代码来源:TPrimitiveArrayListTest.java

示例3: testIteratorAbuseNext

import gnu.trove.list.TIntList; //导入方法依赖的package包/类
public void testIteratorAbuseNext() {
    int element_count = 20;
    TIntList list = new TIntLinkedList();
    for ( int i = 0; i < element_count; i++ ) {
        list.add( i );
    }

    TIntIterator iter = list.iterator();
    while ( iter.hasNext() ) {
        iter.next();
    }
    assertFalse( iter.hasNext() );

    list.remove( 5, 10 );
    assertFalse( iter.hasNext() );
    try {
        iter.next();
        fail( "Expected NoSuchElementException" );
    } catch( NoSuchElementException ex ) {
        // Expected.
    }
}
 
开发者ID:palantir,项目名称:trove-3.0.3,代码行数:23,代码来源:TPrimitiveLinkedListTest.java

示例4: testRetainAllTCollection

import gnu.trove.list.TIntList; //导入方法依赖的package包/类
public void testRetainAllTCollection() {
    int element_count = 20;
    TIntList other = new TIntArrayList();
    for ( int i = 0; i < element_count; i++ ) {
        other.add( i );
    }

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

    assertEquals( element_count, list.size() );
    assertEquals( element_count, other.size() );

    assertFalse( list.retainAll( list ) );

    assertFalse( list.retainAll( other ) );
    assertEquals( element_count, list.size() );
    for ( int i = 0; i < list.size(); i++ ) {
        assertEquals( i , list.get( i ) );
    }

    other.remove( 0 );
    other.remove( 5 );
    other.remove( 10 );
    other.remove( 15 );
    assertTrue( list.retainAll( other ) );
    int expected = element_count - 4;
    assertEquals( expected, list.size() );
    for ( int i = 0; i < list.size(); i++ ) {
        expected = ( int ) Math.floor( i / 4 ) + i + 1;
        assertEquals( "expected: " + expected + ", was: " + list.get( i ) + ", list: " + list,
            expected , list.get( i ) );
    }
}
 
开发者ID:palantir,项目名称:trove-3.0.3,代码行数:37,代码来源:TPrimitiveArrayListTest.java

示例5: testRetainAllTCollection

import gnu.trove.list.TIntList; //导入方法依赖的package包/类
public void testRetainAllTCollection() {
    int element_count = 20;
    TIntList other = new TIntLinkedList();
    for ( int i = 0; i < element_count; i++ ) {
        other.add( i );
    }

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

    assertEquals( element_count, list.size() );
    assertEquals( element_count, other.size() );

    assertFalse( list.retainAll( list ) );

    assertFalse( list.retainAll( other ) );
    assertEquals( element_count, list.size() );
    for ( int i = 0; i < list.size(); i++ ) {
        assertEquals( i , list.get( i ) );
    }

    other.remove( 0 );
    other.remove( 5 );
    other.remove( 10 );
    other.remove( 15 );
    assertTrue( list.retainAll( other ) );
    int expected = element_count - 4;
    assertEquals( expected, list.size() );
    for ( int i = 0; i < list.size(); i++ ) {
        expected = ( int ) Math.floor( i / 4 ) + i + 1;
        assertEquals( "expected: " + expected + ", was: " + list.get( i ) + ", list: " + list,
            expected , list.get( i ) );
    }
}
 
开发者ID:palantir,项目名称:trove-3.0.3,代码行数:37,代码来源:TPrimitiveLinkedListTest.java

示例6: testRemoveAllTCollection

import gnu.trove.list.TIntList; //导入方法依赖的package包/类
public void testRemoveAllTCollection() {
    int element_count = 20;
    TIntList other = new TIntArrayList();
    for ( int i = 0; i < element_count; i++ ) {
        other.add( i );
    }

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

    assertEquals( element_count, list.size() );
    assertEquals( element_count, other.size() );

    assertTrue( list.removeAll( list ) );
    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 );
    }

    assertTrue( list.removeAll( other ) );
    assertEquals( 0, list.size() );
    assertTrue( list.isEmpty() );
    for ( int i = 0; i < list.size(); i++ ) {
        assertEquals( i , list.get( i ) );
    }

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

    other.remove( 0 );
    other.remove( 5 );
    other.remove( 10 );
    other.remove( 15 );
    assertTrue( list.removeAll( other ) );
    int expected = 4;
    assertEquals( "expected: " + expected + ", was: " + list.size() + ", list: " + list ,
            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 ) );
    }
}
 
开发者ID:palantir,项目名称:trove-3.0.3,代码行数:53,代码来源:TPrimitiveArrayListTest.java

示例7: testRemoveAllTCollection

import gnu.trove.list.TIntList; //导入方法依赖的package包/类
public void testRemoveAllTCollection() {
    int element_count = 20;
    TIntList other = new TIntLinkedList();
    for ( int i = 0; i < element_count; i++ ) {
        other.add( i );
    }

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

    assertEquals( element_count, list.size() );
    assertEquals( element_count, other.size() );

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

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

    assertTrue( list.removeAll( other ) );
    assertEquals( 0, list.size() );
    assertTrue( list.isEmpty() );
    for ( int i = 0; i < list.size(); i++ ) {
        assertEquals( i , list.get( i ) );
    }

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

    other.remove( 0 );
    other.remove( 5 );
    other.remove( 10 );
    other.remove( 15 );
    assertTrue( list.removeAll( other ) );
    int expected = 4;
    assertEquals( "expected: " + expected + ", was: " + list.size() + ", list: " + list ,
            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 ) );
    }
}
 
开发者ID:palantir,项目名称:trove-3.0.3,代码行数:53,代码来源:TPrimitiveLinkedListTest.java


注:本文中的gnu.trove.list.TIntList.remove方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。