How to efficiently build a tree from a flat structure?

I have a bunch of objects in a flat structure. These objects have an ID and a ParentID property so they can be arranged in trees. They are in no particular order. Each ParentID property does not necessarily matches with an ID in the structure. Therefore their could be several trees emerging from these objects. … Read more

The term “Context” in programming? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers. Want to improve this question? Update the question so it focuses on one problem only by editing this post. Closed 3 years ago. The community reviewed whether to reopen this question 7 months ago and left it closed: Original close reason(s) … Read more

Which HTTP status code means “Not Ready Yet, Try Again Later”? [closed]

Closed. This question is opinion-based. It is not currently accepting answers. Want to improve this question? Update the question so it can be answered with facts and citations by editing this post. Closed 6 years ago. This post was edited and submitted for review 6 days ago and failed to reopen the post: Original close … Read more

Arguments or parameters? [duplicate]

This question already has answers here: What’s the difference between an argument and a parameter? (36 answers) Closed 9 years ago. I often find myself confused with how the terms ‘arguments’ and ‘parameters’ are used. They seem to be used interchangeably in the programming world. What’s the correct convention for their use? 12 Answers 12

What is opinionated software?

Locked. This question and its answers are locked because the question is off-topic but has historical significance. It is not currently accepting new answers or interactions. I often see people saying that certain software is “very opinionated” or that Microsoft tends to write “un-opinionated” frameworks. What does this actually mean? 9 Answers 9

Picking a random element from a set

How do I pick a random element from a set? I’m particularly interested in picking a random element from a HashSet or a LinkedHashSet, in Java. Solutions for other languages are also welcome. 34 Answers 34 int size = myHashSet.size(); int item = new Random().nextInt(size); // In real life, the Random object should be rather … Read more

What happens when there’s insufficient memory to throw an OutOfMemoryError?

I am aware that every object requires heap memory and every primitive/reference on the stack requires stack memory. When I attempt to create an object on the heap and there’s insufficient memory to do so, the JVM creates an java.lang.OutOfMemoryError on the heap and throws it to me. So implicitly, this means that there is … Read more