I am using TreeBidiMap from the apache collections library. I want to sort this on the values which are doubles.
My method is to retrieve a Collection view of the values using Collection coll = themap.values(). Which naturally works fine. Main Question: I now want to know how I can convert/cast (not sure which is correct) coll into a Li...
I am currently looking to make my own collection, which would be just like a regular list, except that it would only hold 10 items. If an item was added when there were already 10 items in the list, then the first item would be removed before the new item was appended.
What I want to do is create a class that extends System.Collections....
How costly is databinding a collection of objects to a grid (telerik gridview to be specific) vs a regular datatable,
I wouldnt have thought it was an issue but I am doing the databinding via a webservice AJAX callback and if the grid has more than 20 rows it starts to take a noticable time to bind,
...
I would like to expose an ATL COM collection of CMainClass objects
such that it can be accessed by a C#, VB, or C++ client.
I don't have a problem setting up the collection itself, but I don't
know how to allow the COM clients access to classes A, B, and C.
Should I make A, B, & C COM objects with the ones containing a
std::list<> each ...
What is the easiest way to iterate over all the key/value pairs of a java.util.Map in Java 5 and higher?
...
I dont know how to retrieve first Item from this collection :
IGrouping<string, Plantilla> groupCast = group as System.Linq.IGrouping<string, Plantilla>;
I also tryed :
IGrouping<string, Plantilla> firstFromGroup = groupCast.FirstOrDefault();
but not works cause and explicit conversion already exist
...
This problem occurs over and over. I have some complicated object, such as a Cat, which has many properties, such as age, favorite cat food, and so forth.
A bunch of Cats are stored in a Java Collection, and I need to find all the Cats that are aged 3, or those whose favorite cat food is Whiskas. Surely, I can write a custom method ...
I have MyClass, which stores two integers, and I have a Vector<MyClass> called myVector.
Now, I do this:
...
myVector.add(new MyClass(1,1));
for(MyClass m : myVector)
System.out.println(m);
System.out.println(myVector.size());
myVector.remove(new MyClass(1,1));
for(MyClass m : myVector)
System.out.println(m);
System.out.printl...
Is there a Lower Bound function in C# on a SortedList? The function should return the first element equal to or greater than the specified key. Is there some other class that supports this?
Guys - please read the question once again. I do not need a function that returns the key if it is present. I'm interested in scenario when there is...
This is a follow up question to "Is there a basic Java Set implementation that does not permit nulls?". (thank you to all of those who helped with the answer)
It seems that the way to do this, since Sun didn't provide something simple like this OOTB, is with a wrapper / proxy. This seems nearly straight forward. What I am wondering is ...
I'm writing a program in C# that has a custom collection. The custom collection performs some useful aggregate functions (AllSuccessful, %Successful, etc) over it's members which are of type ResultInfo. I have several classes that derive from ResultInfo (UploadResultInfo, XUploadResultInfo, and YUploadResultInfo), and would like to hav...
I've been trying lately to implement some clean coding practices in AS3. One of these has been to not give away references to Arrays from a containing object. The point being that I control addition and removal from one Class and all other users of the Array receive read only version.
At the moment that read only version is a ArrayItera...
Hi,
I'm trying to use a generic custom collection interface (to support injection with Microsoft Patterns and Practices Unity) in a class O/R mapped with iBATIS.NET. Does anyone know if this is possible and if so how to do it?
I have an IDataItemCollection<T> interface that I map to SqlDataItemCollection<T> which extends CollectionBas...
This is—at least at the moment—purely experimentation, but I'm curious: is there a way to attach methods (via prototyping) to collections of elements? I've tested the following code:
<div>a</div>
<div>b</div>
<div>c</div>
<script>
NodeList.prototype._ = function(s)
{
for (x = 0; x < this.length; x++)
{
eval('this[x]' + '....
I need a data structure that holds a list of elements of the same type. Needed features are
Add
GetEnumerator
(may be) Clear
An indexed access, sorting, searching, removing of elements are not required. What is the best collection class for it? The following aspects should be taken in consideration: performance, memory usage, behavio...
In Java, you can have a List of Objects. You can add objects of multiple types, then retrieve them, check their type, and perform the appropriate action for that type.
For example: (apologies if the code isn't exactly correct, I'm going from memory)
List<Object> list = new LinkedList<Object>();
list.add("Hello World!");
list.add(7);
li...
I've written following code and it works too - but I wanted to know whether their is better way than this :
NameValueCollection optionInfoList = ..... ;
if (aSorting)
{
optionInfoListSorted = new nameValueCollection();
String[] sortedKeys = optionInfoList.AllKeys;
Ar...
I have 2 separate classes:
AreaProperties
FieldProperties
1 AreaProperties can map to 1 FieldProperties. Without changing the design, I want a method to return a List<> of these objects
What generic collection in C# would be suitable?
I understand I can send 2 Lists and the function would look like:
public List<AreaProperties> Sa...
A coworker used a for loop to iterate a List in some C# code he wrote and left the comment, "did't use For Each because I wasn't sure it iterates in order. Who knows what Microsoft will do." For example, suppose we have a List built up like this:
var someList = new List<string>();
someList.Add("one");
someList.Add("two");
someList.Ad...
private List<string> _Baseline = new List<string>();
public List<string> Baseline
{
get { return _Baseline; }
set { _Baseline = value; }
}
How can I set this property?
It does not let me add using the add method; it throws an "object reference null" error.
...