The tag has no wiki summary.

learn more… | top users | synonyms

0
votes
0answers
21 views

Specific class to pass a bundle of data from my Model to Controller or a simple Collection?

I am doing an Invoice application implementing MVC pattern design in Java. One of the features my application has to have is showing all info about a Customer: Personal data, Calls, Invoices, ...
1
vote
3answers
96 views

Empty superclass for Collection of derived classes

Basically, what I would like to obtain is a way to iterate through ONE list, and call methods specific to the interface the objects in the collection implement. In my Java project, it would result in ...
-2
votes
0answers
30 views

Is there a way to initialize a container with one line? [migrated]

I am looking for vanilla C++89 solution (no boost, or qt, etc.) Is there a way to do something like this : // valid in c++ 11 std::vector<Foo> vFoo {Foo1, Foo2, Foo3, Foo4} ; or something ...
0
votes
0answers
30 views

How should I populate a list of database-sourced models?

I have a model which sources its data from a MySQL database using a load() public method. If I have a collection of models, I have to loop through each model and call its load() method individually; ...
2
votes
2answers
96 views

Collection vs data structure vs aggregate

I know three terms that have to do with storing objects or data. I'm not sure I understand the exact differences between the terms. Please confirm if what I'm about to write is accurate. A data ...
0
votes
5answers
193 views

Is it a good practice to wrap collection in Java? [closed]

I came across a snippet like this, and find it's over engineering. Is it a good practice? public class SchoolList extends ArrayList<School> { } public class School extends ...
24
votes
5answers
2k views

Why doesn't Java 8 include immutable collections?

The Java team has done a ton of great work removing barriers to functional programming in Java 8. In particular, the changes to the java.util Collections do a great job of chaining transformations ...
2
votes
2answers
301 views

Should I return Collection or ImmutableCollection from a method?

When writing an API in Java, returning an immutable collection of some sort, I've got the option of returning Collection (or List, Map, etc) from the method, or guava's ImmutableCollection (or ...
2
votes
3answers
261 views

is it really necessary for python to differentiate between tuples, lists, dicts, ordered dicts and sets?

i have been learning python over the past month or so. i like many of the things about the language, but i find the differentiation between tuples, lists, dicts, ordered dicts, and sets to be ...
1
vote
1answer
98 views

Search Substring in String collection

I have a big collection of strings a[1], …, a[N] where N is about several millions. I am provided a string m and I need to iterate over all the strings a[i] that contain m. In other words, I need to ...
0
votes
1answer
302 views

What is the most efficient way to manage large collection

I have a rather difficult problem: I periodically receive a Dictionary<decimal, int> subDict containing 100 records where decimal is a Price and int is Amount The outcome I need is a ...
7
votes
4answers
291 views

Is throwing an error in unpredictable subclass-specific circumstances a violation of LSP?

Let's say I wanted to create a Java List<String> (see spec) implementation that uses a complex subsystem, such as a database or file system, for its store so that it acts as a persistent ...
0
votes
2answers
168 views

How can a collection class instantiate many objects with one database call?

I have a baseClass where I do not want public setters. I have a load($id) method that will retrieve the data for that object from the db. I have been using static class methods like ...
2
votes
2answers
172 views

collection naming - singular or plural

This is related to this question but not quite the same. BTW, I'm not a native English speaker. I keep having a hard time choosing a proper name for collections - Lets say that we have a collection ...
9
votes
3answers
2k views

Java Heap Allocation Faster than C++

I already posted this question on SO and it did ok. It was unfortunately closed though(only needs one vote to reopen) but someone suggested I post it on here as it is a better fit so the following is ...
10
votes
3answers
442 views

Why do different java collections have different default capacity?

Looking at different collection constructors the question comes to mind. Why does ArrayList() construct an empty list with an initial capacity of ten and ArrayDeque() constructs an empty array deque ...
-2
votes
1answer
158 views

ArrayList in Java [closed]

I was implementing a program to remove the duplicates from the 2 character array. I implemented these 2 solutions, Solution 1 worked fine, but Solution 2 given me UnSupportedoperationException. I am ...
1
vote
4answers
2k views

Keeping track of all objects of a class

I'm new to object-oriented programming, and I keep running into this issue. (I'm programming in Java) I've been a bit reluctant to ask about this, since it seems like such a basic issue, but I can't ...
1
vote
0answers
237 views

What is the rule on passing around collections? List vs. Ienumerable vs. IQueryable

I do Entity Framework stuff using repository patterns that are passed to the controller to than be called by the client using jquery AJAX.. Is there any basic rules on in what format I should be ...
20
votes
5answers
3k views

Efficient way to shuffle objects

I'm writing a program for some quiz software. I have a question class containing the ArrayLists for the question, answer, options, marks and negative marks. Something like this: class question { ...
9
votes
2answers
1k views

How to unit test method that returns a collection while avoiding logic in the test

I am test-driving a method that is to generate a collection of data objects. I want to verify that the properties of the objects are being set correctly. Some of the properties will be set to the same ...
31
votes
5answers
2k views

I'd like to write an “ultimate shuffle” algorithm to sort my mp3 collection

I'm looking for pseudocode suggestions for sorting my mp3 files in a way that avoids title and artist repetition. I listen to crooners - Frank Sinatra, Tony Bennett, Ella Fitzgerald etc. singing old ...
0
votes
1answer
419 views

Fast lookup hash map implementations

I'm in the process of implementing a programming language on top of LLVM. For my polymorphic system, I'm looking for suggestions for a ultra-fast dictionary. I am not concerned with insert time, as ...
4
votes
1answer
602 views

Is it OK to partially change a collection with PUT or DELETE?

I have a collection of products in a product group e.g.: product-groups/123/products If I need to add to the collection, is it OK that I pass only some products with PUT? If I need to delete some ...
1
vote
2answers
469 views

What is the difference of the add and offer methods of Java's PriorityQueue?

In java.util.PriorityQueue we have the methods add(E e) and offer(E e). Both methods are documented as: Inserts the specified element into this priority queue. What are the differences between ...
2
votes
2answers
545 views

Thoughts on a custom data structure for a node/chain implementation

I am designing a simple GUI that will allow a user to create a GPX route by clicking repeatedly on a map panel. I am faced with a design dilemma for how to represent the nodes and route. This ...
6
votes
3answers
389 views

Functional Methods on Collections

I'm learning Scala and am a little bewildered by all the methods (higher-order functions) available on the collections. Which ones produce more results than the original collection, which ones ...
0
votes
2answers
797 views

Question regarding LinkedList in Java

When I was reading a book for SCJP, I came across the following paragraph. A LinkedList is ordered by index position, like ArrayList, except that the elements are doubly-linked to one another. ...