-
Notifications
You must be signed in to change notification settings - Fork 49
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Test for #518 (Setting a breakpoint inside lambda with object).
- Loading branch information
1 parent
08f40a6
commit a9fe90d
Showing
2 changed files
with
64 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2024 IBM Corporation and others. | ||
* | ||
* This program and the accompanying materials | ||
* are made available under the terms of the Eclipse Public License 2.0 | ||
* which accompanies this distribution, and is available at | ||
* https://www.eclipse.org/legal/epl-2.0/ | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 | ||
* | ||
* Contributors: | ||
* Christian Schima - initial API and implementation | ||
*******************************************************************************/ | ||
import java.util.Optional; | ||
import java.util.function.Consumer; | ||
import java.util.function.Supplier; | ||
|
||
/** | ||
* Test class with lambdas. | ||
*/ | ||
public class ClassWithLambdas { | ||
|
||
private static class Factory { | ||
public static <T> Factory create(Supplier<T> supplier, Consumer<T> consumer) { | ||
return new Factory(); | ||
} | ||
} | ||
|
||
public ClassWithLambdas(String parent) { | ||
Factory.create(() -> Optional.of(""), sample -> new Consumer<Optional<String>>() { | ||
|
||
Optional<String> lastSample = Optional.empty(); | ||
|
||
@Override | ||
public void accept(Optional<String> currentSample) { | ||
lastSample.ifPresent(System.out::println); | ||
currentSample.ifPresent(System.out::println); | ||
lastSample = currentSample; | ||
} | ||
}); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters