diff --git a/src/main/java/org/apache/commons/lang3/concurrent/MultiBackgroundInitializer.java b/src/main/java/org/apache/commons/lang3/concurrent/MultiBackgroundInitializer.java index e08552099..7b663be8f 100644 --- a/src/main/java/org/apache/commons/lang3/concurrent/MultiBackgroundInitializer.java +++ b/src/main/java/org/apache/commons/lang3/concurrent/MultiBackgroundInitializer.java @@ -190,11 +190,11 @@ public class MultiBackgroundInitializer // collect the results final Map results = new HashMap<>(); final Map excepts = new HashMap<>(); - inits.entrySet().forEach(e -> { + inits.forEach((k, v) -> { try { - results.put(e.getKey(), e.getValue().get()); + results.put(k, v.get()); } catch (final ConcurrentException cex) { - excepts.put(e.getKey(), cex); + excepts.put(k, cex); } }); diff --git a/src/test/java/org/apache/commons/lang3/stream/StreamsTest.java b/src/test/java/org/apache/commons/lang3/stream/StreamsTest.java index 073e9cc71..e85957b3c 100644 --- a/src/test/java/org/apache/commons/lang3/stream/StreamsTest.java +++ b/src/test/java/org/apache/commons/lang3/stream/StreamsTest.java @@ -168,12 +168,23 @@ public class StreamsTest extends AbstractLangTest { assertEquals(2, Streams.of(Arrays.asList("A", "B")).collect(Collectors.toList()).size()); } + @Test + public void testOfIterableNotNull() { + assertEquals(2, Streams.of((Iterable) Arrays.asList("A", "B")).collect(Collectors.toList()).size()); + } + @Test public void testOfCollectionNull() { final List input = null; assertEquals(0, Streams.of(input).collect(Collectors.toList()).size()); } + @Test + public void testOfIterableNull() { + final Iterable input = null; + assertEquals(0, Streams.of(input).collect(Collectors.toList()).size()); + } + @Test public void testOfEnumeration() { final Hashtable table = new Hashtable<>(); @@ -188,17 +199,6 @@ public class StreamsTest extends AbstractLangTest { assertEquals(2, collect.size()); } - @Test - public void testOfIterableNotNull() { - assertEquals(2, Streams.of((Iterable) Arrays.asList("A", "B")).collect(Collectors.toList()).size()); - } - - @Test - public void testOfIterableNull() { - final Iterable input = null; - assertEquals(0, Streams.of(input).collect(Collectors.toList()).size()); - } - @Test public void testSimpleStreamFilter() { final List input = Arrays.asList("1", "2", "3", "4", "5", "6");