online compiler and debugger for c/c++

code. compile. run. debug. share.
Source Code   
Language
/****************************************************************************** Welcome to GDB Online. GDB online is an online compiler and debugger tool for C, C++, Python, Java, PHP, Ruby, Perl, C#, OCaml, VB, Swift, Pascal, Fortran, Haskell, Objective-C, Assembly, HTML, CSS, JS, SQLite, Prolog. Code, Compile, Run and Debug online from anywhere in world. *******************************************************************************/ import java.util.*; import java.util.stream.*; import java.util.function.*; public class Main { public static void main(String[] args) { new Main().savePageInSeparatedTransaction( p -> new Page<A>() { @Override public List<A> getContent() { return Arrays.asList(new A(1), new A(2), new A(3)); } }, null, // a -> new B(a.a + 5), // converter Main::saverOk, // saver new Pageable() {} // pageable //PageRequest.of(0, 20_000, Sort.Direction.ASC, "id.lim") ); } static void saverOk(List<B> data) { System.out.println(data); } static void saverClassCast(List<B> data) { for (B b : data) { System.out.println(b); } } protected <T, R> Page<T> savePageInSeparatedTransaction( Function<Pageable, Page<T>> sourceSupplier, Function<T, R> converter, Consumer<List<R>> saver, Pageable pageRequest ) { return getTransactionTemplate().execute(s -> { Page<T> sourcePage = sourceSupplier.apply(pageRequest); List<R> converted = converter == null ? (List<R>) sourcePage.getContent() : sourcePage.stream() .map(converter) .collect(Collectors.toList()); saver.accept(converted); return sourcePage; }); } /* protected <T> Page<T> savePageInSeparatedTransaction( Function<Pageable, Page<T>> sourceSupplier, Consumer<List<T>> saver, Pageable pageRequest ) { return getTransactionTemplate().execute(s -> { Page<T> sourcePage = sourceSupplier.apply(pageRequest); saver.accept(sourcePage.getContent()); return sourcePage; }); } */ private TransactionTemplate getTransactionTemplate() { return new TransactionTemplate(); } } // end of Main class A { int a; public A(int a) {this.a = a;} @Override public String toString() { return "A:a=" + a;} } class B { int b; B(int x) {this.b = x;} B(A a) {this.b = a.a * 2;} @Override public String toString() { return "B:b=" + b;} } class TransactionTemplate { public <T> T execute(TransactionCallback<T> action) { return action.doInTransaction(new TransactionStatus(){}); } } interface TransactionCallback<T> { T doInTransaction(TransactionStatus status); } interface TransactionStatus { } interface Pageable { } interface Page<T> { default Stream<T> stream() { return getContent().stream(); } List<T> getContent(); }

Compiling Program...

Command line arguments:
Standard Input: Interactive Console Text

                

                

Program is not being debugged. Click "Debug" button to start program in debug mode.

#FunctionFile:Line
VariableValue
RegisterValue
ExpressionValue