Maybe you can consider using Document::getList method
List<Integer> years = document.getList("years", Integer.class);
Here is the offical documentation.