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 {
@Test @Ignore
public void a08consumer() {
// 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"));
cons.accept(list);
......@@ -106,7 +106,7 @@ public class A_LambdasAndMethodReferences {
@Test @Ignore
public void a09consumer() {
// 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"));
cons.accept(list);
......
......@@ -117,7 +117,7 @@ public class A_LambdasAndMethodReferences {
@Test
public void a08consumer() {
// TODO: write a lambda expression that clears the given list.
//UNCOMMENT//Consumer<StringBuilder> cons = null;
//UNCOMMENT//Consumer<List<String>> cons = null;
//BEGINREMOVE
Consumer<List<String>> cons = list -> list.clear();
//ENDREMOVE
......@@ -130,7 +130,7 @@ public class A_LambdasAndMethodReferences {
@Test
public void a09consumer() {
// TODO: write a method reference that clears the given list.
//UNCOMMENT//Consumer<StringBuilder> cons = null;
//UNCOMMENT//Consumer<List<String>> cons = null;
//BEGINREMOVE
Consumer<List<String>> cons = List::clear;
//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