List < T > function ( ) { Arrays . sort ( buffer , 0 , bufferSize , comparator ) ; if ( bufferSize > k ) { Arrays . fill ( buffer , k , buffer . length , null ) ; bufferSize = k ; threshold = buffer [ k - 1 ] ; } return Collections . unmodifiableList ( Arrays . asList ( Arrays . copyOf ( buffer , bufferSize ) ) ) ; }
returns the top k elements offered to this topkselector , or all elements if fewer than k have been offered , in the order specified by the factory used to createthis topkselector . the returned list is an unmodifiable copy and will not be affected by further changes to this topkselector . this method returns in o k log k time . concode_field_sep Comparator<? super T> comparator concode_elem_sep T threshold concode_elem_sep int k concode_elem_sep T[] buffer concode_elem_sep int bufferSize concode_field_sep void offer concode_elem_sep int partition concode_elem_sep void trim concode_elem_sep void swap concode_elem_sep void offerAll concode_elem_sep void offerAll concode_elem_sep TopKSelector<T> least concode_elem_sep TopKSelector<T> least concode_elem_sep TopKSelector<T> greatest concode_elem_sep TopKSelector<T> greatest concode_elem_sep TopKSelector<T> combine