Home / 14:48 / 14:48 / 14:48

Daily Archives: 28/05/2020

Fastest way to get the first n elements of a List into an Array

Fastest way to get the first n elements of a List or an Array

def s = ‘Hello Groovy world!’ assert s.take(5) == ‘Hello’ assert s.drop(6) == ‘Groovy world!’ Python Let’s assume an arbitrary list/array: in_list = list(range(10)) // Python2: in_list = range(10) // in_array = [i for i in range(10)] Slicing the list ...

Read More »