Java Code Examples for it.unimi.dsi.fastutil.longs.LongList#size()

The following examples show how to use it.unimi.dsi.fastutil.longs.LongList#size() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SemiExternalGammaListTest.java    From database with GNU General Public License v2.0 5 votes vote down vote up
public void testSemiExternalGammaListGammaCoding() throws IOException {

		long[] longs = { 10, 300, 450, 650, 1000, 1290, 1699 };
		LongList listLongs = new LongArrayList( longs );

		SemiExternalGammaList list = new SemiExternalGammaList( buildInputStream( listLongs ), 1, listLongs.size() );
		for ( int i = 0; i < longs.length; ++i ) {
			assertEquals( ( "test failed for index: " + i ), longs[ i ], list.getLong( i ) );
		}

		list = new SemiExternalGammaList( buildInputStream( listLongs ), 2, listLongs.size() );
		for ( int i = 0; i < longs.length; ++i ) {
			assertEquals( ( "test failed for index: " + i ), longs[ i ], list.getLong( i ) );
		}

		list = new SemiExternalGammaList( buildInputStream( listLongs ), 4, listLongs.size() );
		for ( int i = 0; i < longs.length; ++i ) {
			assertEquals( ( "test failed for index: " + i ), longs[ i ], list.getLong( i ) );
		}

		list = new SemiExternalGammaList( buildInputStream( listLongs ), 7, listLongs.size() );
		for ( int i = 0; i < longs.length; ++i ) {
			assertEquals( ( "test failed for index: " + i ), longs[ i ], list.getLong( i ) );
		}
		
		list = new SemiExternalGammaList( buildInputStream( listLongs ), 8, listLongs.size() );
		for ( int i = 0; i < longs.length; ++i ) {
			assertEquals( ( "test failed for index: " + i ), longs[ i ], list.getLong( i ) );
		}
    }
 
Example 2
Source File: SemiExternalGammaListTest.java    From database with GNU General Public License v2.0 5 votes vote down vote up
public void testEmptySemiExternalGammaListGammaCoding() throws IOException {

		long[] longs = {  };
		LongList listOffsets = new LongArrayList( longs );

		new SemiExternalGammaList( buildInputStream( listOffsets ), 1, listOffsets.size() );
		assertTrue( true );
    }
 
Example 3
Source File: ValueInTransformFunction.java    From incubator-pinot with Apache License 2.0 5 votes vote down vote up
private static long[] filterLongs(LongSet longSet, long[] source) {
  LongList longList = new LongArrayList();
  for (long value : source) {
    if (longSet.contains(value)) {
      longList.add(value);
    }
  }
  if (longList.size() == source.length) {
    return source;
  } else {
    return longList.toLongArray();
  }
}