Logo

Programming-Idioms

This language bar is your friend. Select your favorite languages!
  • Java
import static java.lang.System.out;
import java.util.List;
elements = elements.stream()
                   .map(x -> x * c)
                   .toList();
import java.util.stream.Collectors;
elements = elements.stream().map(e -> e*c).collect(Collectors.toList());

elements is of type List<Integer>, or something that can be multiplied.
stream turns it into a stream.
map does the multiplication
collect turns it back into a List.
for E of elements loop
   E := E * c;
end loop;

New implementation...
< >
Bzzzzzzzzz