Why does java collections not supply a function for the index of max value?
I have been using Collections.max(list)
for many projects, but I occasionally want to find the index of that maximum element. I feel silly writing a function to do this for myself in every program I write.
Why does java collections not supply a function for the index of max value?
I have been using Collections.max(list)
for many projects, but I occasionally want to find the index of that maximum element. I feel silly writing a function to do this for myself in every program I write.
What should I do in C++ when implementing a container class: storing objects by value or by reference?
I’m new to C++, coming from Java.
What should I do in C++ when implementing a container class: storing objects by value or by reference?
I’m new to C++, coming from Java.
What should I do in C++ when implementing a container class: storing objects by value or by reference?
I’m new to C++, coming from Java.
CopyOnWriteArrayList: Why do we have to make a full copy of source data?
I have a lot of confusion about Java’s CopyOnWriteArrayist. I know, when we have a modification on it like update, insert of set, it will lock the whole list, copy out a total copy of the source list, do the modification and then release the lock. So, My question is:
Should I accept empty collections in my methods that iterate over them?
I have a method where all logic is performed inside a foreach loop that iterates over the method’s parameter:
Is there an alternative to instanceof when filtering a Java stream by class?
I have an unexpected situation in a project in which all types extending one class are packed into a Java collection; but only a specific extension of that class contains an additional method. Let’s call it “also()”; and let me be clear that no other extension has it. Right before performing one task on every item in that collection, I need to call also() on every item that implements it.
Maintain ordered collection by updating as few `order` fields as possible
I’m working on integrating a reorderable lists UI widget with a Meteor.js (MongoDB, in effect) collection:
Maintain ordered collection by updating as few `order` fields as possible
I’m working on integrating a reorderable lists UI widget with a Meteor.js (MongoDB, in effect) collection: