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)

3
votes
3answers
91 views

C++ Dynamic array based stack

This is my first post so if I am doing something wrong in the post please let me know. I have implemented a dynamic array based stack. Can someone point out any pitfalls or things that can be done ...
1
vote
0answers
26 views

.NET List Serializer design

A few weeks back I wrote a class to help serialize/deserialize objects file. The file format requested was json, then compressed. After some coding/testing I settled on this design: ...
2
votes
1answer
76 views

Auto-resizing array, that accepts negative indexes

I've been coding a helper container template to contain tiles in 2D games. What I figured out I would like when writing code for my games is forgetting all resize stuff, allowing negative indexes (for ...
3
votes
1answer
31 views

Buffered read from a large list

There is a large list of email addresses and there is a limitation of max 100 email addresses to process once. This is the code I have written. ...
3
votes
2answers
36 views

Automatically keyed map

I have written a class that is designed to be an automatically keyed Map in Java. Here is my implementation: ...
2
votes
1answer
109 views

Searching two different elements in a same list

I have a list of conversion histories, where information about user channels is stored. For example user may have app for iOS and Android installed. Each time user logs in, I store a conversion ...
0
votes
1answer
52 views

HashMap or other collection?

I need to parse a space- delimited text file. I want to read the file and do operations for each cell. Here is how I am parsing the file: ...
6
votes
1answer
104 views

Multi-function memoizator and multi-type container

I'm trying to write a multiple functions memoizator, which I've talked about here. The main problem is creating a container containing different and heterogenous functions. I found a working ...
0
votes
0answers
20 views

Find items in collection one that are the greatest value less than an item in collection two

This is hard to explain. I wanted to get all of the items in collection one (ints in the example below) that are the highest values that are lower than any of the items in collection two (otherInts). ...
1
vote
1answer
78 views

Using T type parameter to clone a collection

I want to clone a collection with the following method and I want to know if it can be optimized: ...
1
vote
1answer
60 views

Returning a collection of unique elements: List<T> using Contains() or HashSet<T>

I'm writing a binary PowerShell module and have recently started to add wildcard support to some cmdlets. I'm not sure if I'm using an efficient way of creating the final collection of objects to ...
0
votes
1answer
53 views

A Java subclass of ArrayList that supports rotation in constant time - follow-up

(See the previous (and initial) iteration.) Compared to the previous iteration, I have added more methods that maintain the invariant required for constant time rotations, such as bulk add/remove, ...
7
votes
3answers
338 views

A Java subclass of ArrayList that supports rotation in constant time

(See the next iteration.) I have subclassed java.util.ArrayList in order to be able to "rotate" it in constant time simply by moving a finger index. See what I ...
2
votes
1answer
41 views

Comparing two shuffling methods

I'm trying to randomly shuffle an collection of integers within a List and I have came up with two shuffling method that does the job. However, I'm not sure which ...
1
vote
0answers
44 views

Update method using timer in WinForms Poker app

I have a WinForms Poker app that needs to update some stuff and im doing this by using a timer: ...
2
votes
1answer
87 views

Poker app in C#

I am developing a poker application using C#. It is almost done, and I'm looking for improvements. One of the things I wonder is whether I should change my method that checks if the player has a ...
0
votes
0answers
30 views

Splitting two ObservableCollections lightning fast

I'm working on wiring up a bindable Map for Xamarin Forms, and I need a fast way of dividing up the ObservableCollections (collection of map markers) as quickly as possible. Collections are a weak ...
-1
votes
2answers
85 views

PHP Dependecy Injection Container

A few weeks ago, I asked for another DIC review, but didn't get any response (but only for one about my error handling). So I tried to rework my DIC without any outside insight on it, and the first ...
4
votes
1answer
88 views

Skip list in Python

I've made an attempt at writing a skip list in Python. I'm using NumPy to generate geometric random variables, but since that's a bit of a heavy dependency to drag around I could easily implement that ...
5
votes
2answers
236 views

Custom sorting of dates

I have implemented a class which implements a list of my custom DateObj. I have sorted the list in a peculiar manner based on the current month. I achieved my ...
3
votes
0answers
180 views

GSL-like array_view implementation

I've seen a couple GSL-like string_view-ish implementations on CR recently, but don't recall seeing anything like array_view yet ...
0
votes
2answers
78 views

Combining several collections into one

Is there a way to rewrite this code to make it more laconic? I'm using Java 6. ...
4
votes
3answers
112 views

Loops to merge documents and renumber pages

I have a for loop implementation for merging documents and page re-numbering. But since I am modifying the collection while iterating, I suspect that the code might ...
3
votes
2answers
181 views

Custom Implementation of ObservableDictionary

I recently found myself in need of an IDictionary<TKey,TValue> implementation that was observable from a WPF UI. Since the .Net framework does not provide ...
4
votes
3answers
80 views

File Parsing in Java Using Collection

I have the following requirements: /* Collection Write a program that counts the number of unique words in a large text file. a] Store the words in a collection and report the number of ...
1
vote
1answer
56 views

IReadOnlyCollection with notifications

It is not related to GUI. I have a class with: Private List, which is edited inside the class. Open IReadOnlyCollection ...
1
vote
3answers
105 views

Diffing two lists of business objects

dataListOne and dataListTwo will be full of BO objects (around 4000 - 5000). Lets say ...
1
vote
1answer
306 views

Ordered dictionary in swift 2

Loosely basing myself on this blog post, I implemented an ordered dictionary. In essence, it's a wrapper struct for a list of tuples with some initialisers and some functions (map, filter, toArray, ...
10
votes
1answer
93 views

ConcurrentDecayingHashMap<K,V>, a concurrent decaying HashMap

I wrote a wrapper for Java's ConcurrentHashMap that enables you to add a decay time to inserted values, meaning they will be automatically removed after the given ...
1
vote
0answers
24 views

Custom expression that filters elements based on jQuery internal data

With jQuery, I'd like to be able to easily select the following types of elements: Elements that have a specific value set for a specific data attribute in the raw HTML Elements that have had a ...
4
votes
2answers
386 views

Mean, Median and Mode of a QVector

I would like some help condensing this code down to size. I am trying to utilize Qt's container classes as efficiently as possible. I do not believe this code reflects my objective. ...
1
vote
0answers
55 views

Better way to deep copy than this? How can I make it generic by `Collection` type?

Could I make this method for deep copy generic to the Collection type? That method is so simple and I can't imagine ever needing to change it, so maybe I should ...
6
votes
1answer
251 views

Finding anagrams

I recently had a potential employer send me a programming test to read through a file and write to another file all the words that were anagrams (two or more words containing the same letter). The ...
5
votes
2answers
434 views

C++ equivalent of Python's deque with maxlen - sliding window

In Python it is really easy to get sliding window functionality using a deque with maxlen: ...
4
votes
2answers
128 views

Find if the prefix of the string exists in the values of the hash table

I have a hash map which maps to some strings which serve as prefixes and are of small length (max length is 6): ...
7
votes
3answers
54 views

Pulling Docker Machine IP

I am working with MongoDB through Docker, and I have a terrible bash command to pull the Docker Machine IP so I can sanely connect locally. ...
6
votes
1answer
423 views

Efficient top k words using MultiMap (Google Guava ext lib JAR)

Basic algorithm: Open document/huge text file Use Map and List to separate the words. \$O(K)\$ time complexity (TC) ...
4
votes
2answers
2k views

Loop through column cells and compare value with a Collection

I have a Collection of 166 elements: ...
0
votes
0answers
92 views

Custom ConcurrentHashMap for ints

I've implemented a concurrent hash map for int primitives. ...
3
votes
1answer
57 views

Removing an object which is wrapped in another object from a collection

I have Clips that can be added to or removed from any number of Lines. When I add the Clip, ...
10
votes
3answers
174 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
51 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 ...
4
votes
1answer
23 views

GroupBy field with and without white spaces

I have these invoices listed: ...
2
votes
3answers
111 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
3k 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 ...
6
votes
1answer
131 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
393 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
368 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
113 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 ...