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)

6
votes
3answers
97 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
59 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
84 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
42 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
101 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
264 views
2
votes
2answers
86 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
125 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
138 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
93 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
121 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
111 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
1answer
183 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
86 views

UniqueList Class in VBA

I often find myself abusing dictionary objects just for the exist method like this, ...
10
votes
3answers
255 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
143 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
148 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
94 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
59 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
163 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: ...
8
votes
2answers
97 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 ...
3
votes
1answer
82 views

Construct KD-Tree in Java

I want to construct KD-Tree from unsorted List of points in the plane (i.e. 2-KD-Tree). To do so I used the method from Wikipedia: http://en.wikipedia.org/wiki/Kd-tree#Construction This is my code: ...
1
vote
1answer
88 views

Static map initialization [closed]

I have the following "working" static map: ...
8
votes
2answers
881 views

Efficient way of sorting a List based on multiple properties using Google Guava

I'm using Google Guava 17.0 library. I have a class named AroundBust containing only two properties id of type ...
4
votes
1answer
85 views

Finding the longest word from a list of words

I have a list of words (with repetitions), and I intend to find out the longest words amongst them, along with their length. My question is to know if my implementation is too verbose, is using too ...
9
votes
2answers
204 views

Twitter Streaming Client - Round#2

This is round #2. The initial code review is: Twitter Streaming API Client: Identifying the top trending hashtags for a specific term For a list of changes since the last review, please see this. ...
10
votes
3answers
2k views

Sorting numbers using Java Collections.sort()

Input is a file containing numbers in this format: 1.2 3 5.1 2 7 4 6 5 2 9.22 1 0.0 4 3 I am doing the sorting in the simplest way, using ...
2
votes
1answer
158 views

Generic util method to convert in single map from list of array of Object generally result of JPQL/ hibernate

I have designed a generic method to convert list of array of Objects to result into single map. This is working fine, but I want to check weather a key object is valid key (whether it is overriding ...
0
votes
1answer
86 views

Filter a collection

In my project, there are some methods which filter some items from a collection. I was told to use the C++ STL whenever I can. But when I use std::copy_if, I feel ...
7
votes
2answers
604 views

Deallocate all memory in a container of pointers

I want to erase all memory in a container. Currently I'm using this : ...
2
votes
0answers
99 views

Associative container that produces a unique, instance specific handle for each inserted object

It is not always possible to simplify program design by strictly managing the lifetimes of objects. If two objects have unpredictable lifetimes, but one of them needs to refer to the other, a simple ...
5
votes
4answers
375 views

Iterate over two collections of equal length

What's the best way to iterate over two collections of equal length? Currently I'm using this: ...
4
votes
2answers
92 views

Addition plus division taking up all my CPU - Kinect depth denoising

I have a method in my class that eats up something like 80% of my processor time while its running. In-fact one line within the method is responsible for the majority of this. The idea behind this ...
6
votes
3answers
123 views

Detecting available List operations

I'm writing some code which needs to take a generic java.util.List from another source and adapt to the available functions; eg. does it support ...
2
votes
3answers
114 views

Containers and lists

I want to create a container that has an AutoList object list. I wonder if my container is correct. ...
9
votes
1answer
331 views

Is my C++11 generic container a good design?

After refactors and refactors and the discovery of very common patterns on many of the classes of the software I wrote, I decided that it would be fine to have something like an arbitrary-keyed map, ...
4
votes
1answer
81 views

Does the class have unnecessary and violating Single responsibility principle method?

I encountered with the following code in the work. The MyItemCoordinator should receive MyItem objects, process them, add them ...
8
votes
2answers
120 views

Container for list of ranges

I made a C++ container of an ordered list of integers, that, in order to save space, I save as ranges: For example, the list \$ \{1,2,3,5,6,7,8,9,20\} \$ is saved in memory as \$ \{(1,3), (5,9), ...
10
votes
3answers
3k views

Implementation of stack using pointers

Please review my code and let me know how I can possibly improve it. ...
20
votes
4answers
2k views

Just a lowly counter that turned out to be surprisingly complicated

While writing this review, I saw a need for a Counter object similar to Python's. It seemed like it would be easy to write such a class, but it turned out to be ...
6
votes
2answers
121 views

Clean, efficient and extensible code for querying collections

I recently wrote code that would query a collection of objects and rank them according to a given criteria and then filter based on an object property. I attach the code below. I would like to know if ...
4
votes
1answer
135 views

Converting data when output std container via ostream_iterator

I have a strongly typed enum and std::vector of this type. ...
10
votes
1answer
194 views

Allowing user space file-system to (kind-of) keep more than maximum number of files open

The linked code below is meant to be used in a user space file-system (fuse). Given that multiple processes may have multiple files opened on the file-system, the files on the specific user space ...
6
votes
1answer
424 views

Simple sparse array

Today, I tried to create a really simple sparse_array container adapter. I did not provide all the STL-like functions, only the elementary ones as a proof of ...
2
votes
1answer
120 views

Bidirectional map based on memory manipulation

This is a bidirectional map implementation that stores the values as pairs on the heap, and uses pointer arithmetic for efficient lookup. codepad link, may be easier to read ...
10
votes
3answers
403 views

Unrolled linked list

Does anyone have any feedback on my unrolled linked list class? I did it just for fun. I am interested in the performance tradeoffs of linked lists, standard lists and unrolled linked lists. This ...
4
votes
1answer
162 views

Boost multi-index based orderbook

As suggested here, I'm using Boost multi-index to implement orderbook. So far my code looks like this: "CommonsNative.h" contains ...
5
votes
1answer
78 views

One-line initialisation for a constant list with all entries except one from another list

I'm looking to simplify the initialisation of the second constant, preferably to just one line. Any ideas? Anything from Guava or JDK (up to 1.6) is ok to use. ...
3
votes
3answers
132 views

Forcing type-safe IDs for use with Collections and Maps

Introduction I have a hierarchically nested tree class (like SampleFolder, s.b.) that I want to serialize. The problem arises with the collection of sub items ...
5
votes
3answers
556 views

Inserting interval into a collection

The task is fairly simple. I want to create a collection of intervals and implement an Add method which would insert new intervals to the collection and merge ...