Questions tagged [collections]

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

Filter by
Sorted by
Tagged with
52 votes
3 answers
15k views

List<T> implementation for VB6/VBA

Recently I decided VB6's Collection wasn't enough for my needs, so I decided to implement something like C#'s List<T>. ...
Mathieu Guindon's user avatar
10 votes
3 answers
806 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 ...
RubberDuck's user avatar
  • 30.8k
3 votes
2 answers
2k views

Non generic Skip List implementation in C++ Version 2

Edit: This code was reworked and repostetd under a new question: Generic Skip list implementation in C++ Version 3 This is a follow up of: Non generic Skip List implementation in C++ If you don't ...
Sandro4912's user avatar
  • 3,056
6 votes
1 answer
1k 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) considering ...
JustVirtually's user avatar
4 votes
1 answer
70 views

A collection based on a bitset to store a set of unique integers from a given range (rev. 2)

This is a continuation of this review. I applied most of the proposed changes. These changes were focused mostly on decoupling the class from the rest of the program and making its interface more like ...
Piotr Siupa's user avatar
3 votes
0 answers
168 views

Simple generic macro-generated containers

In order to learn macros in C I decided to make a generic data structures generator for other projects that I have in C. The main macros are the following: ...
LeoVen's user avatar
  • 337
30 votes
4 answers
3k 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 ...
200_success's user avatar
17 votes
2 answers
2k views

O(1) lock free container

This is a lock-free Container class. By Container I mean it will hold objects for iteration at a later time. To achieve \$O(1)\$ ...
OldCurmudgeon's user avatar
15 votes
3 answers
5k 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 ...
RubberDuck's user avatar
  • 30.8k
13 votes
1 answer
243 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 solution,...
user6321's user avatar
  • 347
12 votes
1 answer
272 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 ...
Christoph's user avatar
  • 507
11 votes
2 answers
11k 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 ...
RubberDuck's user avatar
  • 30.8k
9 votes
1 answer
2k views

Generic Skip list implementation in C++ Version 3

This is a follow up of Non generic Skip List implementation in C++ Version 2 If you don't know what a Skip list is: https://en.wikipedia.org/wiki/Skip_list I tried to incorporate as much ...
Sandro4912's user avatar
  • 3,056
9 votes
2 answers
504 views

Multi-dimensional container using operator[]

This is a late followup to a previous question of mine on same subject. Context: I want to have a tool that allows to use all the C++ goodies (algorithms, for loop on containers, etc.) on a ...
Serge Ballesta's user avatar
9 votes
1 answer
237 views

Class containers, filtering and coding practices

Context Usually, when I have to deal with a collection of items (especially objects) I tent to create a container class for that collection (wrapper?). What I mean by that is: when I have to handle ...
FlameHorizon's user avatar
8 votes
2 answers
539 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) ...
Christoph's user avatar
  • 507
7 votes
1 answer
300 views

Custom implementation to provide an immutable range of a container without copying it

I needed to pass a const reference to part of a std::vector without copy. I posted the previous version in my earlier question, thank you for the great support! As ...
Dávid Tóth's user avatar
7 votes
3 answers
700 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 ...
coderodde's user avatar
  • 27.6k
7 votes
3 answers
974 views

Custom collection implementing IList<T> saving current, next and previous element

I'm developing a Tic Tac Toe game where you can change your pawn look Now as You can see it has 2 buttons one for next one for previous, and You can also pick if you want to edit the O or the X ...
Denis's user avatar
  • 8,458
7 votes
1 answer
176 views

Cascading a property for a game

I'm trying to write a simple game. I have an Entity object, that has a list of Sprite objects. Each ...
Big McLargeHuge's user avatar
7 votes
1 answer
2k views

Implementation of fixed size queue using a ring (cyclic) buffer

I found myself in need of a fixed size queue and decided to implement one using a ring (cyclic) buffer. I have tried my best to match the API of std::queue with ...
Emily L.'s user avatar
  • 16.6k
6 votes
1 answer
2k views

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

This question has been superseded by C++11 lock free collection similar to std::forward_list - follow-up 2 Thread safe and lock free collections are very hard to write, so I'd appreciate any feedback,...
Brent's user avatar
  • 451
6 votes
2 answers
1k views

Iterator of Container of Container

Based on this question I though I would pull together an iterator that iterated over a container of containers. ...
Martin York's user avatar
  • 94.6k
5 votes
1 answer
2k 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: ...
sc_ray's user avatar
  • 1,213
4 votes
1 answer
84 views

Fill a new Workbook with info from another workbook

I made a macro that will fill in data in a workbook that has 65 (24 are user filled) columns and can go as long as 1500 rows. In an ideal scenario, the workbook has a perfect column that could work ...
rzenva's user avatar
  • 73
4 votes
2 answers
747 views

Non generic Skip List implementation in C++

Edit: This code was reworked and repostetd under a new question: Non generic Skip List implementation in C++ Version 2 To sharpen my C++ skills I tried to implement a skip list. I was quite happy ...
Sandro4912's user avatar
  • 3,056
4 votes
1 answer
100 views

General use multi-dimensional container using operator[]

This is a followup to a previous question of mine on same subject. Context I want to have a tool that allows to simulate as much as possible a C++ standard container for a multidimensional ...
Serge Ballesta's user avatar
3 votes
2 answers
1k views

Kings Drinking Game

This Review Request evolves into this Review Request now with a custom UI and other changes. I wrote a program to simulate the drinking card game Kings. This is my third Java Project. I didn't quite ...
Dinocv's user avatar
  • 381
3 votes
0 answers
126 views

Allowing switching between operator[] and at() based on NDEBUG macro version

The problem: std::vector and other containers have two functions for accessing / modifying their content: operator[] and ...
gaazkam's user avatar
  • 561
3 votes
1 answer
71 views

Python JIT container type

This is a follow on from this review. Where I am attempting to improve the performance of my rest client. I have created an container type (as suggested in my previous post) that lazily instantiates ...
James Schinner's user avatar
3 votes
1 answer
6k views

Generating all subsets of a given set

I am learning Java Collections Framework. Can someone look at this code for generating all subsets of a given set and tell me any issues with it. ...
Rohit Agarwal's user avatar
2 votes
2 answers
76 views

Automatically keyed map

I have written a class that is designed to be an automatically keyed Map in Java. Here is my implementation: ...
Jack Wilsdon's user avatar
  • 1,651
2 votes
1 answer
38 views

A collection based on a bitset to store a set of unique integers from a given range (rev. 3)

All right, let's do this one last time. This is continuation of this review. I applied most of the proposed changes, making interface of my container very close to that of ...
Piotr Siupa's user avatar
2 votes
1 answer
122 views

Python: rearranging data collection

Let's say I have a data collection, like a list, containing a set of objects with particular properties. Let's go with animals: [ cow, sheep, orangutan ] An animal ...
dabadaba's user avatar
  • 341
2 votes
1 answer
484 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 ...
Yk Cheese's user avatar
  • 113
2 votes
1 answer
2k views

Generic Macro Generated Linked List in C

Generate a linked list of any type using macros. The linked list contains functions for adding and removing elements to both ends and also at the middle. You can also add elements relatively to a list ...
LeoVen's user avatar
  • 337
2 votes
1 answer
530 views

Force ConcurrentDictionary in a Singleton Registry to Collect Removed Items/Space

I have the following class which is used in a WebApi AspNetCore application as a singleton instance to store Strategy objects (reference type). The class is ...
MoonKnight's user avatar
2 votes
1 answer
201 views

Simple C++ circular queue

I wrote a simple C++20 circular queue. https://github.com/torrentg/cqueue Here is cqueue.hpp ...
Gerard Torrent's user avatar
2 votes
1 answer
426 views

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

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 hpp, followed by some tests. This question ...
Brent's user avatar
  • 451
2 votes
1 answer
3k views

Vector-like custom container with improved insert performance

I rolled a little container class (just for couriosity) which was meant to be able as a vector replacement in some cases. (Whoever wonders about the lack of move semantic etc, I just left it out due ...
Mango's user avatar
  • 485
2 votes
2 answers
187 views

Vector replacer

I rolled an own vector-like construct with improved performance and got it reviewed. Here is the updated version. ...
Mango's user avatar
  • 485
1 vote
1 answer
79 views

Collection that uses a bitset to store a huge set of unique integers from a given range (rev. 1)

Some (skippable) context: I'm writing program that minimizes an arbitrary logical function. Such function takes an unsigned integer as an argument and returns either ...
Piotr Siupa's user avatar
1 vote
2 answers
142 views

Threadsafe filtering queue

I have implemented a thread safe filtering queue. The queue allows any objects, of the specified type to be added. A thread interested to take an object must specify which object it is interested in ...
Bruno Costa's user avatar
  • 5,566
0 votes
1 answer
127 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, ...
coderodde's user avatar
  • 27.6k