Skip to content
Snippets Groups Projects
Commit 9cba9f2a authored by Stuart Marks's avatar Stuart Marks
Browse files

minor fixes to lambda & method references exercises

parent cee323ca
No related branches found
No related tags found
No related merge requests found
...@@ -96,7 +96,7 @@ public class A_LambdasAndMethodReferences { ...@@ -96,7 +96,7 @@ public class A_LambdasAndMethodReferences {
@Test @Ignore @Test @Ignore
public void a08consumer() { public void a08consumer() {
// TODO: write a lambda expression that clears the given list. // TODO: write a lambda expression that clears the given list.
Consumer<StringBuilder> cons = null; Consumer<List<String>> cons = null;
List<String> list = new ArrayList<>(Arrays.asList("a", "b", "c")); List<String> list = new ArrayList<>(Arrays.asList("a", "b", "c"));
cons.accept(list); cons.accept(list);
...@@ -106,7 +106,7 @@ public class A_LambdasAndMethodReferences { ...@@ -106,7 +106,7 @@ public class A_LambdasAndMethodReferences {
@Test @Ignore @Test @Ignore
public void a09consumer() { public void a09consumer() {
// TODO: write a method reference that clears the given list. // TODO: write a method reference that clears the given list.
Consumer<StringBuilder> cons = null; Consumer<List<String>> cons = null;
List<String> list = new ArrayList<>(Arrays.asList("a", "b", "c")); List<String> list = new ArrayList<>(Arrays.asList("a", "b", "c"));
cons.accept(list); cons.accept(list);
......
...@@ -117,7 +117,7 @@ public class A_LambdasAndMethodReferences { ...@@ -117,7 +117,7 @@ public class A_LambdasAndMethodReferences {
@Test @Test
public void a08consumer() { public void a08consumer() {
// TODO: write a lambda expression that clears the given list. // TODO: write a lambda expression that clears the given list.
//UNCOMMENT//Consumer<StringBuilder> cons = null; //UNCOMMENT//Consumer<List<String>> cons = null;
//BEGINREMOVE //BEGINREMOVE
Consumer<List<String>> cons = list -> list.clear(); Consumer<List<String>> cons = list -> list.clear();
//ENDREMOVE //ENDREMOVE
...@@ -130,7 +130,7 @@ public class A_LambdasAndMethodReferences { ...@@ -130,7 +130,7 @@ public class A_LambdasAndMethodReferences {
@Test @Test
public void a09consumer() { public void a09consumer() {
// TODO: write a method reference that clears the given list. // TODO: write a method reference that clears the given list.
//UNCOMMENT//Consumer<StringBuilder> cons = null; //UNCOMMENT//Consumer<List<String>> cons = null;
//BEGINREMOVE //BEGINREMOVE
Consumer<List<String>> cons = List::clear; Consumer<List<String>> cons = List::clear;
//ENDREMOVE //ENDREMOVE
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment