public static < T > ItemsSketch < T > getInstance ( final int k , final Comparator < ? super T > comparator ) { final ItemsSketch < T > qs = new ItemsSketch <> ( k , comparator ) ; final int bufAlloc = 2 * Math . min ( DoublesSketch . MIN_K , k ) ; //the min is important qs . n_ = 0 ; qs . combinedBufferItemCapacity_ = bufAlloc ; qs . combinedBuffer_ = new Object [ bufAlloc ] ; qs . baseBufferCount_ = 0 ; qs . bitPattern_ = 0 ; qs . minValue_ = null ; qs . maxValue_ = null ; return qs ; }
Obtains a new instance of an ItemsSketch .