public int [ ] getRoles ( ) { List < Integer > roles = new ArrayList < Integer > ( ) ; for ( int i = 0 ; i < data . length ; i ++ ) { if ( data [ i ] != null ) { roles . add ( i ) ; } } int [ ] res = new int [ roles . size ( ) ] ; for ( int i = 0 ; i < res . length ; i ++ ) { res [ i ] = roles . get ( i ) ; } return res ; }
Returns the roles stored in this data structure .