code: public static <T> List<SelectableItem> listOf(
              Collection<T> items,
              Function<T, String> idFn,
              Function<T, String> nameFn,
              Predicate<T> selectedFn
      ) {
          return items.stream()
                  .map(i ->
                          new SelectableItem(
                                  selectedFn.test(i),
                                  idFn.apply(i),
                                  nameFn.apply(i)
                          )
                  )
                  .collect(Collectors.toList());
      }
docs: Creation of a list of selectable items from a list of items, using an extractor for the id and the name,
  and a predicate for the selection.