Top "Idiomatic" questions

A programming idiom is the usual and customary way to write code in a particular language.

How can I initialise a static Map?

How would you initialise a static Map in Java? Method one: static initialiser Method two: instance initialiser (anonymous subclass) or …

java dictionary collections initialization idiomatic
How do I reverse an int array in Java?

I am trying to reverse an int array in Java. This method does not reverse the array. for(int i = 0; …

java arrays idioms idiomatic
When to use std::size_t?

I'm just wondering should I use std::size_t for loops and stuff instead of int? For instance: #include <…

c++ types idiomatic size-t loop-counter
Multiple constructors: the Pythonic way?

I have a container class that holds data. When the container is created, there are different methods to pass data. …

python constructor initialization initializer idiomatic
Idiomatic efficient Haskell append?

List and the cons operator (:) are very common in Haskell. Cons is our friend. But sometimes I want to add …

haskell performance linked-list append idiomatic
When is it appropriate to use an associated type versus a generic type?

In this question, an issue arose that could be solved by changing an attempt at using a generic type parameter …

types rust idiomatic