Top "Lambda" questions

DO NOT USE FOR THE AWS SERVICE (use [aws-lambda] for those questions!

Java 8 lambdas, Function.identity() or t->t

I have a question regarding the usage of the Function.identity() method. Imagine the following code: Arrays.asList("a", "b", "…

java lambda java-8 java-stream
Conditional statement in a one line lambda function in python?

Apologies if this has been asked before, but I couldn't see it anywhere. Essentially I've come across a scenario where …

python if-statement lambda ternary-operator conditional-operator
In Java 8 how do I transform a Map<K,V> to another Map<K,V> using a lambda?

I've just started looking at Java 8 and to try out lambdas I thought I'd try to rewrite a very simple …

java map lambda java-8 java-stream
Uses of Action delegate in C#

I was working with the Action Delegates in C# in the hope of learning more about them and thinking where …

c# lambda delegates action
Can a java lambda have more than 1 parameter?

In Java, is it possible to have a lambda accept multiple different types? I.e: Single variable works: Function <…

java lambda java-8
Modifying local variable from inside lambda

Modifying a local variable in forEach gives a compile error: Normal int ordinal = 0; for (Example s : list) { s.setOrdinal(ordinal); …

java lambda java-8
How can I throw CHECKED exceptions from inside Java 8 streams?

How can I throw CHECKED exceptions from inside Java 8 streams/lambdas? In other words, I want to make code like …

java lambda java-8 java-stream checked-exceptions
Java 8 optional: ifPresent return object orElseThrow exception

I'm trying to make something like this: private String getStringIfObjectIsPresent(Optional<Object> object){ object.ifPresent(() ->{ String …

java lambda optional
Order a List (C#) by many fields?

I want to order a List of objects in C# by many fields, not just by one. For example, let's …

c# list lambda sql-order-by
Using lambda expressions for event handlers

I currently have a page which is declared as follows: public partial class MyPage : System.Web.UI.Page { protected void …

c# performance events lambda