Collections.sort(list, (item1, item2) -> item2.id.length() - item1.id.length());Item itemWithLongestId = list.get(0);