List<String> (@Nullable ServiceViewItem item) { List<String> path = new ArrayList<>(); while (item != null) { String id = item.getViewDescriptor().getId(); if (id == null) { return null; } path.add(id); item = item.getParent(); } Collections.reverse(path); return path; }