Logo

Programming-Idioms

This language bar is your friend. Select your favorite languages!

Idiom #363 Set to list

Create the list y from the set x.

The resulting list y may be in any order.

y := make([]T, 0, len(x))
for v := range x {
	y = append(y, v)
}

x is a map[T]struct{}

T is the type of the items

New implementation...
< >
programming-idioms.org