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)

0
votes
0answers
19 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 ...
0
votes
2answers
68 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 ...
2
votes
1answer
28 views

A 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
174 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
65 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
1answer
56 views

Combining several collections into one

Is there a way to rewrite this code to make it more laconic? I'm using Java 6. ...
3
votes
2answers
69 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 ...
1
vote
1answer
62 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
68 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
55 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
98 views

Diffing two lists of business objects

dataListOne and dataListTwo will be full of BO objects (around 4000 - 5000). Lets say ...
1
vote
1answer
115 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, ...
6
votes
0answers
64 views

ConcurrentDecayingHashMap<K,V>, a concurrent decaying HashMap

I wrote a wrapper for Javas ConcurrentHashMap that enables you to add a decay time to inserted values, meaning they will be automatically removed after the given time. This functionality is ...
1
vote
0answers
19 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
156 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
50 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
193 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
378 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
85 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): ...
6
votes
3answers
50 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
226 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
1k views

Loop through column cells and compare value with a Collection

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

Custom ConcurrentHashMap for ints

I've implemented a concurrent hash map for int primitives. ...
3
votes
1answer
56 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
162 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
49 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
109 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
2k 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
112 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
304 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
216 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
93 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 ...
4
votes
2answers
297 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
656 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
70 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
144 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
829 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
390 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
157 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
41 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
3k 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
235 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
1k 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
126 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
1k 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
486 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
667 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
53 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: ...