gpt-4-0314· OpenAI
WildChat-4.8M (AI2)
rewrite this so there is no casting to Number return batches.stream()…
- User
rewrite this so there is no casting to Number return batches.stream() .max(Comparator.comparingInt(batch -> batch.stream() .filter(item -> item instanceof Number) .mapToInt(item -> ((Number) item).intValue()) .sum())) .orElse(Collections.emptyList());
- Assistant
return batches.stream() .max(Comparator.comparingInt(batch -> batch.stream() .filter(Number.class::isInstance) .mapToInt(item -> item.intValue()) .sum())) .orElse(Collections.emptyList());