@ Override public int [ ] toArray ( ) { final int [ ] array = new int [ this . getCardinality ( ) ] ; int pos = 0 , pos2 = 0 ; while ( pos < this . highLowContainer . size ( ) ) { final int hs = BufferUtil . toIntUnsigned ( this . highLowContainer . getKeyAtIndex ( pos ) ) << 16 ; final MappeableContainer c = this . highLowContainer . getContainerAtIndex ( pos ++ ) ; c . fillLeastSignificant16bits ( array , pos2 , hs ) ; pos2 += c . getCardinality ( ) ; } return array ; }
Return the set values as an array if the cardinality is less than 2147483648 . The integer values are in sorted order .