public ContainerPointer getContainerPointer ( final int startIndex ) { return new ContainerPointer ( ) { int k = startIndex ; @ Override public void advance ( ) { ++ k ; } @ Override public ContainerPointer clone ( ) { try { return ( ContainerPointer ) super . clone ( ) ; } catch ( CloneNotSupportedException e ) { return null ; // will not happen } } @ Override public int compareTo ( ContainerPointer o ) { if ( key ( ) != o . key ( ) ) { return Util . toIntUnsigned ( key ( ) ) - Util . toIntUnsigned ( o . key ( ) ) ; } return o . getCardinality ( ) - getCardinality ( ) ; } @ Override public int getCardinality ( ) { return getContainer ( ) . getCardinality ( ) ; } @ Override public Container getContainer ( ) { if ( k >= RoaringArray . this . size ) { return null ; } return RoaringArray . this . values [ k ] ; } @ Override public boolean isBitmapContainer ( ) { return getContainer ( ) instanceof BitmapContainer ; } @ Override public boolean isRunContainer ( ) { return getContainer ( ) instanceof RunContainer ; } @ Override public short key ( ) { return RoaringArray . this . keys [ k ] ; } } ; }
Create a ContainerPointer for this RoaringArray