List<TypeAnnotationWriteHelper> (Type type, List<TypeAnnotationWriteHelper> typeAnnWriteHelpers) { return typeAnnWriteHelpers.stream().filter(stack -> { boolean isArrayPath = stack.getPaths().size() < type.getArrayDim(); if (stack.getPaths().size() > type.getArrayDim()) { for (int i = 0; i < type.getArrayDim(); i++) { stack.getPaths().poll(); // remove all trailing } } return !isArrayPath; }).collect(Collectors.toList()); }