generic-collections Questions

4

Solved

What does it mean? I used a list of list in ASP.NET MVC and sent them through ViewData of ActionResuls to retrieve it in views. However, when I change it to list of list, it gives me an error of H...
Blotto asked 11/7, 2010 at 12:55

10

Solved

I have a list stored in resultlist as follows: var resultlist = results.ToList(); It looks something like this: ID FirstName LastName -- --------- -------- 1 Bill Smith 2 John Wilson 3 Doug Ber...
Agrostology asked 4/4, 2012 at 20:44

2

Solved

I was reading an article and about collection.abc and typing class in the python standard library and discover both classes have the same features. I tried both options using the code below a...
Pang asked 30/1, 2023 at 14:18

8

Solved

Basically, I want something like this: Dictionary<object, string> dict = new Dictionary<object, string>(); dict.Add(null, "Nothing"); dict.Add(1, "One"); Are there ...
Rovner asked 16/12, 2009 at 18:50

5

Solved

Here is this sample code: static class Store { private static List<String> strList = new List<string>(); private static HashSet<String> strHashSet = new HashSet<string>()...
Concrescence asked 23/4, 2016 at 18:54

7

Solved

If I understood correctly (and please correct me if i'm wrong), list is implemented by array in .NET, which means that every deletion of an item in the list will cause re-allocation of all the list...
Parsaye asked 29/12, 2012 at 13:16

2

If I want to create a Cartesian product of a list of lists in Haskell, I can do this: product [] = [[]] product (xs:xss) = concatMap (\k -> map (k:) (product1 xss)) xs or even this: sequence...
Karalynn asked 6/12, 2017 at 7:22

6

Solved

If I have a Dictionary<String,...> is it possible to make methods like ContainsKey case-insensitive? This seemed related, but I didn't understand it properly: c# Dictionary: making the Key c...
Narcisanarcissism asked 21/12, 2012 at 10:46

10

Solved

In Java, a set only checks for equality of an object with objects already in the set only at insertion time. That means that if after an object is already present in the set, it becomes equal to an...
Glutamine asked 20/2, 2015 at 13:19

1

Solved

I am calling a library method that returns a raw Stream. I know the type of the elements in the stream and want to collect into a collection with the declared element type. What is the nice, or the...

3

Solved

For level order traversal why does this exception occur? Following exception occurs: Cannot implicitly convert type 'System.Collections.Generic.List<System.Collections.Generic.List<int>...
Tapping asked 2/2, 2018 at 2:3

2

Solved

I am in need of a Generic collection that is somewhere in between a Dictionary and LinkedList. I want to be able to: Access elements by key Access previous and next elements I've taken a look a...
Curriculum asked 27/10, 2011 at 0:21

1

Solved

This method is defined in a JpaRepository and runs a native PostgreSQL query. List<Long> distributorIds = distributorRepository .findDistributorIdsWithChildren(distributorId) It runs with ...
Summertime asked 31/3, 2020 at 10:28

4

Solved

I have a class with a collection of Wildcard Types that is a singleton, something like: public ObliviousClass{ private static final ObliviousClass INSTANCE = new ObliviousClass(); private Map&...
Equality asked 8/5, 2012 at 22:28

1

I have many controllers with same methods, difference is only entity class. I want to create generic BaseController and having problem with QuerydslPredicate annotaion (cannot set root, this is ge...
Quarters asked 27/5, 2016 at 11:6

2

Solved

Goal: Generic enumerated type to be the same type when returned. Note: This works when the types are entered but I don't understand why they can't be inferred. List<T> then return List<T...
Hulking asked 4/12, 2018 at 19:48

1

Solved

I'm trying to write a generic method that takes any number of arguments that are keys to an object and use the values of their keys as arguments to a constructor. This is my original implementation...
Septime asked 8/8, 2018 at 0:20

1

Solved

I have been the last days fighting with some issues regarding generics on Swift, and I don't find a way to figure out how to achieve this: I have a class class Store<S: State> where State i...
Nocti asked 23/1, 2018 at 11:59

2

Solved

My goal is to load 1.48 million items from XML files into a in memory generic collections dictionary using C# ASP.NET MVC along with ability to render filter lists to views. Right now it works with...
Gingerich asked 30/10, 2013 at 20:26

3

Solved

I have a two class which is having following properties Class A { public int CustID { get; set; } public bool isProcessed { get; set; } } Class B { public int EmpId{ get; set; } public b...
Skilling asked 27/2, 2017 at 17:45

5

Solved

Does anyone know why the following code does not compile? Neither add() nor addAll() works as expected. Removing the "? extends" part makes everything work, but then I would not be able to add subc...
Percale asked 23/3, 2011 at 15:52

6

I'm trying to make a type-safe generic linked list in C using macros. It should work similarly to how templates work in C++. For example, LIST(int) *list = LIST_CREATE(int); My first attempt was...
Chemist asked 22/2, 2012 at 19:55

1

Solved

It's been long since I write a single line of code so, please, be patient if I am asking a dumb question. Even though the IntelliSense shows the Intersect method after Names, I get the following e...
Stickup asked 10/12, 2016 at 2:55

4

I have a little problem when i want to do some operations in c#. I will give you a little example. Stack<List<HufmannLetter>> steps = new Stack<List<HufmannLetter>>(); Lis...
Debutant asked 19/11, 2016 at 18:7

8

Solved

What's the standard way to get a typed, readonly empty list in C#, or is there one? ETA: For those asking "why?": I have a virtual method that returns an IList (or rather, post-answers, an IEnumer...
Cool asked 8/10, 2010 at 22:36

© 2022 - 2025 — McMap. All rights reserved.