Open thinhdnn opened 1 year ago
My cases:
Because here. results.add((Integer) current[0], (Long) current[1]); get exception Index of outbound for case 1 Cannot add index 1 to empty list.
for (Future result : fResults) { try { Object[] current = (Object[]) result.get(); maxDuration = Math.max((Long) current[1], maxDuration); results.add((Integer) current[0], (Long) current[1]); } catch (InterruptedException e) { e.printStackTrace(); } catch (ExecutionException e) { e.printStackTrace(); } }
My cases:
Because here. results.add((Integer) current[0], (Long) current[1]); get exception Index of outbound for case 1 Cannot add index 1 to empty list.
for (Future result : fResults) { try { Object[] current = (Object[]) result.get(); maxDuration = Math.max((Long) current[1], maxDuration); results.add((Integer) current[0], (Long) current[1]); } catch (InterruptedException e) { e.printStackTrace(); } catch (ExecutionException e) { e.printStackTrace(); } }