Questions tagged [generic-collections]

A collection that supports generic typing of its elements

Since java 1.5 (released in 2004), the JDK java.util.Collection interface is generic (typed).

Unless you're using an ancient version of java, the word "generic" in "generic collections" is redundant.

390 questions
-1
votes
1 answer

Delphi: Generic class definitions, asynchronous newbie

I came from Delphi 2007, have been using this for 7 years and started working with RAD Studio Berlin in my new work place. The projects I am working on use a lot of TDictionary, Generics collections, asynchronous...etc. For examaple, there is a…
Ricky Nelson
  • 197
  • 1
  • 1
  • 7
-1
votes
1 answer

How to add some value in generic wildcard map

I have gone through couple of related questions but those are not help me out. Actually, I have a method whose return type is Map and I want to do unit test using Mockito. Sample Code is: Map resultMap =…
-1
votes
2 answers

Generic Method to get Distinct of LIST

I am trying to compare (values of the properties) a instance of type in a List and eliminate duplicates. According to MSDN GetHashCode() is one of the way to compare two objects. A hash code is intended for efficient insertion and lookup in …
HaBo
  • 13,999
  • 36
  • 114
  • 206
-1
votes
1 answer

UNITY c#:is it possible to change True and False button to 4 different button choices and still using "public bool"?

I made a quiz but true and false are the only buttons, Got them from a tutorial which is brackeys how do I make them to 4 buttons with 4 different choices. and assign them to button objects in unity here are my codes for true and…
-1
votes
2 answers

generic object and function object

I try to write generic tree. I added function object to compare among the values of the vertices. but I got problem: the relevant parts of the header file: template ..... void addData(T dataIn,Func condition){ the…
Ohad Shamir
  • 37
  • 1
  • 6
-1
votes
1 answer

Managed class types as type of type parameter T (Error C2670)

I want to create a generic function returning a collection of type ObservableCollection^. Callers pass a managed class type for type parameter T. Here is one of my tries of the generic function, after that explanations of other classes…
Christian St.
  • 1,751
  • 2
  • 22
  • 41
-1
votes
1 answer

System.Generics.Collections differences in XE8 compared to other Delphi versions

I have the following unit I have used for some Delphi versions. But now I am testing XE8 and I get an error in function THolydayList.TEnglishNameCollection.ToArray: TArray; begin Result := ToArrayImpl(fList.Count); end; I think is has to…
OZ8HP
  • 1,443
  • 4
  • 31
  • 61
-1
votes
3 answers

Confusion about Collections.sort(List list, Comparator c) example

Here is the code import java.util.ArrayList; import java.util.Collections; import java.util.Comparator; import java.util.List; class Dog implements Comparator, Comparable { private String name; private int age; Dog() { …
Aman Grover
  • 1,621
  • 1
  • 21
  • 41
-1
votes
2 answers

C# XNA Draw blips when alien is detected

I'm sure this has a very simple solution but I'm just not sure how to go about it. In fact I don't even know where to start. I'm attempting to make a really basic game where several (local)players walk around a single screen level with detection…
user2279244
  • 11
  • 1
  • 1
  • 5
-1
votes
2 answers

Converting Linked List toString into Generic

I am writing a Linked List class that takes in names or numbers, and then prints them out in a list. I managed to write the list normally. Here is what I did: public String toString(){ return list.toString; //where list is the LinkedList I am…
user1404664
  • 73
  • 1
  • 2
  • 8
-1
votes
2 answers

Populating Nested List<> in MVC4 C#

I've got a problem populating nested List<> The object graph looks like this: Route ⇒ Section ⇒ Co-ordinates Whenever I try to populate Сoordinates list it just overwrites previous record and at the end gives me only the last Coordinate record.…
-1
votes
1 answer

Change the LinkedList class into a generic collection similar to the java.util.ArrayList class

This is a LinkedList that have methods to modify the list. One of the things I have to do is: Change the LinkedList class into a generic collection similar to the java.util.ArrayList class. I don't know how to do that? import…
user2022871
  • 111
  • 1
  • 1
  • 5
-2
votes
2 answers

Generic method call for related methods

How can I make this code better? It would be better if I could modify method GetItemsInfo() to send several types at one call. using System.Collections.Generic; using System.Linq; public class SomeClass { List itemBase; ... public…
-2
votes
2 answers

AddRange() is not working when adding list items to a Collection

Recently I got a task to work on one of the FxCop warning - Do not expose generic lists. So I tried changing the List to ICollection. But later point of time, while doing the unit testing I found that the AddRange() is not working properly as…
Vijay
  • 745
  • 2
  • 9
  • 25
-2
votes
2 answers

LINQ fetching sequence values

The below list providing a collection of integers. My requirement is to return sequence values are like first 1,2,3,4,5. once the sequence gets less than or equal 1. fetching will be stopped. I could use for loop to do this operation, but I need to…
sebu
  • 2,824
  • 1
  • 30
  • 45
1 2 3
25
26