Collections APIs provide developers with a set of classes and interfaces that makes it easier to handle collections of objects.

learn more… | top users | synonyms (1)

7
votes
3answers
77 views

Writing a program to read a maximum of 99 elements in an iteration from a list

I want to read a list of elements and pass a maximum of 99 elements to a function for some logical operations. I have tried this with an array as an example and this code was successful in achieving ...
1
vote
1answer
38 views

Properly managing a collection from deserialized XML file throughout app's lifetime

I'm developing a WinForms app to manage some settings and profiles for multiple video games. The list of video games is specified by the user, and I'm trying to figure out how to properly maintain ...
1
vote
0answers
63 views

Modifying a key automatically in a look-up dictionary when it is changed through a bound control in C# [closed]

I have implemented a BindingKeyedCollection (a keyed collection implementing IBindingList) which should allow me using it as a ...
2
votes
0answers
7 views

GroupBy field with and without white spaces

I have these invoices listed: ...
2
votes
3answers
100 views

Is one-sided equality more helpful or more confusing than quick failure?

My question is about the equals() method. Most people implement equals() to start like: ...
5
votes
2answers
355 views

Optimize method to iterate to over Map<String, List<Object>>

I have a Map<String, List<Object>> multiFieldMap and I need to iterate over its value set and add the value to ...
4
votes
0answers
47 views

Storing collections of objects of any type

I've put together a class whose goal is to store objects of arbitrary type, with each type having its own vector for contiguity. I'd like to gather advice on what I have so far before I carry on. Let ...
2
votes
2answers
80 views

Observable Collection “Deep”

In a project of mine I needed a class "Document" to be able to notify any change in its fields. This class keep a collection of class "AnotherClass". Using an ObservableCollection for this collection ...
2
votes
1answer
68 views

Fixed size double-ended queue

I require hundreds of equal, small sized buffers in my current project. The bulk of the computation in the program operates on data stored directly in those containers, so high performance is ...
3
votes
2answers
52 views

Simple medical collection/database about patients visits

I am writing a system for doctors who are regularly visited by patients. The doctor adds each patient's visit to collection/database. The class can save data to an .xml file and restore it. Can you ...
3
votes
2answers
93 views

C# Tree implementation

I’m working on a C# implementation of a tree class. The tree will be used wherever I need to store data in a tree format. (Application Menu, File Infos etc.). Therefore the tree should support a lot ...
5
votes
1answer
132 views

Hacker Rank: Extracting digits from a given number and check for divisibility

The problem in question is a coding challenge from Hackerrank: Problem Statement You are given an integer N. Find the digits in this number that exactly divide N (division that leaves 0 as ...
2
votes
1answer
41 views

The information system of the institution

I've made a small project from my institute. I've got 5 classes, in 4 of the classes (Teachers, Students, ...
4
votes
1answer
70 views

Union of intervals

I am trying to solve for the problem with a bunch of intervals: (1,2),(2,5),(4,7),(9,11) I find their union, which in the above given case would be: ...
0
votes
2answers
206 views

Array to Tuple in Swift

I am burdened with the requirement of interacting with a C based library, which has a bunch of constant sized arrays (e.g. char[17]). When trying to assign or read ...
8
votes
3answers
169 views

Collection that can be modified in a foreach

Sometimes you want to add/remove items from a collection inside of a foreach loop. Since this isn't possible, a common pattern is to add the items to a separate ...
4
votes
3answers
100 views

Thread safe cache for write through and writeback

This cache is like a list where new elements are inserted in the middle, cache hits are put to head of the list and replaced elements are taken from the end. Would I just use a list the lookup would ...
1
vote
0answers
36 views

NonEmptySortedSet implementation

I'm looking for feedback specifically about what I might add to this to make it more usable or general, especially with regard to scala collection traits to implement. ...
4
votes
3answers
847 views

Generic sum method for a Collection<Number>

While answering this question, I wanted to use a generic sum of Collection function. Java doesn't have a native method, so I wrote one. There are a couple things ...
8
votes
2answers
218 views

Efficiently create and sort a Collection

The goal of my code is to sort data into two categories. It must use a local copy of the initial data from Collar (Top View).csv. My code creates a Collection of items called Collars using the initial ...
3
votes
2answers
630 views

Word Ladder Solution in Java using ArrayList

Word Ladder Given a start word and a goal word, convert the start word to the goal word by changing one letter at a time. Each step must also be a valid word. Is my code modular? I mean are ...
4
votes
1answer
74 views

C++11 lock free collection similar to std::forward_list - follow-up

Thread safe and lock free collections are very hard to write, so I'd appreciate any feedback, especially regarding bugs. The code below is a self contained cpp including some tests. This question is ...
3
votes
2answers
279 views

Wiring CollectionView and grouping it without slowing it down

In my previous question, I got heaps of good advice BUT no solution for the problem apposed. I applied the valuable learnings from the past on this.question and am also hitting it from a different ...
3
votes
3answers
260 views

Find intersection of two arrays without duplicates

A = [9, 1, 4, 2, 5] k unique integers B = [3, 1, 8, 7, 6, 5] n unique integers Intersection => [1, 5] Find an algorithm that uses \$O(1)\$ space (the space used by the return variable is not ...
3
votes
3answers
245 views

Implementing a singly LinkedList and IList interface

I have implemented a LinkedList in C#. What would you change/make better? What naming conventions are misused? What would you add? Some of my ideas are to make it ...
2
votes
2answers
43 views

Remove list of files from another list of files by their name

In groovy I have a list of files A and also another list of files B. I want to remove all the files from A that have a filename that also occurs in the list of files B. I wrote the following code: ...
4
votes
1answer
99 views

C++11 lock free collection similar to std::forward_list [closed]

I'm new to explicit memory ordering, and any kind of thread safety is hard to implement right to begin with. Please let me know if you see any problems, or have suggestions for improvement. Written in ...
4
votes
2answers
404 views

Subsorting with multiple Comparators

I've seen a number of questions on Stack Overflow of the kind of "How do I sort on fields X AND Y?" The most common answers to those questions consists of "Write a custom Comparator." But what if you ...
10
votes
3answers
419 views

Collection with both Set and List interface

Here's something I wrote a while ago. I needed a collection that was ordered, but also guaranteed duplicates did not occur. So I made a class with both Set and List interfaces. It seems to work ...
6
votes
3answers
176 views

Extension method to enumerate a hierarchical object

I have a domain object that I have no control over which itself contains a collection of this same type. This is a classical hierarichal representation like in a tree node hierarchy. I would like to ...
4
votes
1answer
101 views

Container adaptors

How to improve the functionality, exception safeness and other aspects of the following container adaptors? Allows to write more generic code (not working for, say, ...
2
votes
1answer
231 views

ArrayList for Shop implementatin

Problem statement: Design a system for the following scenario: An item list contains item code, name, rate, and quantity for several items. Whenever a new item is added in the list ...
7
votes
1answer
50 views

Joining collections… because it's fun

I'm working on a LinqEnumerable class (reviewable here), and I'm no Big-O expert and I'm pretty bad with algorithms, so I wonder what the complexity is for what ...
-1
votes
1answer
2k views

ArrayList implementation in C [closed]

Although I know I can use calloc then realloc to make a dynamic array in C, and that I also need a variable to keep track of the ...
2
votes
2answers
606 views
2
votes
2answers
109 views

Performance enhancement for collection manipulation

I have below snippet of code which gets all the available menu items for a zone(top or left)and adds the widgets for which user has access to an ArrayList collection. For now the ...
7
votes
2answers
160 views

Array-like container for uints shorter than 8 bits (Rev 1)

This is a follow-up to Array-like container for uints shorter than 8 bits In short: The PackedBitfieldArray should be a kind of container for packed (unsigned) ...
11
votes
1answer
148 views

Array-like container for uints shorter than 8 bits

Follow-up: Array-like container for uints shorter than 8 bits (Rev 1) First of all: yes, I need this kind of array to generate data for a piece of hardware, and it must be stored and manipulated ...
-1
votes
2answers
99 views

LinkedVector : a vector of elements with links to other elements

I wanted to have a vector with usual values and with some sort of indexing : an element can have links to other elements (via indices). Something like the following, where ...
10
votes
1answer
251 views

Container with sorted by multiple keys

From this question: Sorted vector (aka flat_set) for objects (pointers) with custom embedded key (functor used) This is an example of a multi-index container. Note: this is not a container as ...
5
votes
3answers
158 views

Finding the closest value in a collection in a game-server plugin implementation

I have an array of a instances of an enum type. A random double variable is initialized with a value between 0.... to 1, and should be used to get the closest ...
5
votes
2answers
475 views

Concurrent Linked Hash Set

Basically I want to create a concurrent LinkedHashSet which returns proper size too. I am mainly concerned about adding and removing iterations. Suggestions ...
5
votes
2answers
147 views

UniqueList Class in VBA

I often find myself abusing dictionary objects just for the exist method like this, ...
10
votes
3answers
652 views

Building a better Collection. Enumerable in VBA

VBA's 'Collection' is.... lacking, so, I've been working on a better Collection object that implements many of the features of C#'s Enumerable. This is very much inspired by this question and a follow ...
5
votes
2answers
147 views

Reducing the execution time of Online Community-Even Groups challenge

I have a coding problem for which I have attempted to solve with the below coding. However, my program is assessed as too slow in its execution and thus needs to be optimized to reduce the execution ...
10
votes
2answers
565 views

Sorting a collection

Related to, but not exactly a follow up of this question. After fixing some issues discovered in the last review, I added a little more functionality to the ...
8
votes
3answers
157 views

More imitation of Enumerable in VBA

I was inspired by Me How's question to see how far I could push an imitation of .Net's Enumerable Class. The new functions can obviously handle Collections, but can also handle any collection-type ...
2
votes
3answers
71 views

Code to evaluate a dotted quad IP address has clumsy use of inject/fold - can I match the pattern in Ruby?

I wrote this to consume valid IPv4 addresses in dotted-quad decimal form. ...
7
votes
2answers
228 views

Interface-based polymorphic collection

Here is a small C++11 utility collection to store any object that satisfies a given interface. Only the basic concepts are provided, I did not try to create a full collection: ...
9
votes
2answers
109 views

Splitting two lists into OnlyA, Both, and OnlyB

This is a part of my Minesweeper analyzer code that didn't fit into the last question. This code uses FieldGroup which ...