Mohammad Rezaei

Results 94 comments of Mohammad Rezaei

They are very closely related concepts. They are often mentioned together (e.g. from [C++](https://learn.microsoft.com/en-us/cpp/cpp/lambda-expressions-in-cpp?view=msvc-170), just to broaden this a bit: "In C++11 and later, a lambda expression—often called a lambda—is...

`ALWAYS_TRUE` is a "closed" expression (as in, it doesn't require any more context from its environment). In that sense, it's the simplest possible "closure" of a lambda expression -- one...

To me, it doesn't matter how it was instantiated. What matters is how it behaves. Does it take a parameter and return a result? Yub, it sure is a lambda....

> but properly speaking, a "lambda" in an expression. Source? It seems rather contradictory on its face. A "lambda expression" is an expression. Why would people go around using "lambda...

> if you take for example the last reference, it doesn't actually refer to functions by the term "lambda" (it only discusses "lambda expressions" and "lambda functions"). Ok, let's start...

The linked performance data has some serious issues. The largest collection size tested is 1000. The data shows a clear trend where the sized variant is getting faster and faster...

Sorry, I didn't realize this was limited to sizes 4 or less. That's likely much harder to optimize in a meaningful way. The most relevant line from the benchmark is...

The statement "passing a pre-sized array is dangerous for a concurrent or synchronized collection" seems to contain a misunderstanding of the contract of `toArray`. Here is the javadoc: > Returns...

on `java.util.concurrent.ConcurrentHashMap` calling `toArray(new X[0])` and `toArray(new X[c.size()])` will return identical results, as the function, once again, allocates `new X[c.size()]` in the first case. So it's trimmed regardless (which seems...

Sorry, I misread the code: it only trims if the array sent in was too small. So it honors the contract of the function as specified in `Collection`. So the...