int[] () { List<Object> items = myListModel.getItems(); if (items.isEmpty()) return ArrayUtil.EMPTY_INT_ARRAY; return IntStream.range(0, items.size()) .filter(i -> mySelectedItems.contains(items.get(i))) .toArray(); }