Top "Enumerable" questions

"enumerable" refers to an ordering scheme that enables items in a set, sequence or collection to be readily addressed or traversed.

What is the difference between map, each, and collect?

In Ruby, is there any difference between the functionalities of each, map, and collect?

ruby enumerable
Skip over iteration in Enumerable#collect

(1..4).collect do |x| next if x == 3 x + 1 end # => [2, 3, nil, 5] # desired => [2, 3, 5] If the condition for next is met, collect …

ruby enumerable
Why does Enumerable.All return true for an empty sequence?

var strs = new Collection<string>(); bool b = strs.All(str => str == "ABC"); The code creates an empty …

c# .net linq enumerable
Group hashes by keys and sum the values

I have an array of hashes: [{"Vegetable"=>10}, {"Vegetable"=>5}, {"Dry Goods"=>3>}, {"Dry Goods"=>2}] I need to …

ruby hash key enumerable
How do I create an empty Stream in Java?

In C# I would use Enumerable.Empty(), but how do I create an empty Stream in Java?

java java-stream enumerable
Rails lists have .first and .second – is there a .hundredth or .sixty_nineth ?

Is there a class or other extension for Rails that allows more than the first few elements in a series (…

ruby-on-rails ruby enumerable
What is the effect of AsEnumerable() on a LINQ Entity?

Reading the questions here and here has given me some insight into the situation, and it seems like using the …

c# linq entity enumerable
Excluding one item from list (by Index), and take all others

There is a List<int> containing some set of numbers. Randomly I select an index, which will be …

c# .net linq list enumerable
How to get Enum object by value in C#?

I recently encountered a case when I needed to get an Enum object by value (to be saved via EF …

c# object enums helper enumerable
What's the fastest way in Ruby to get the first enumerable element for which a block returns true?

What's the fastest way in Ruby to get the first enumerable element for which a block returns true? For example: …

ruby arrays enumerable